-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
173 lines (130 loc) · 3.9 KB
/
server.js
File metadata and controls
173 lines (130 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//configures firebase into the project
const firebaseConfig = {
apiKey: "AIzaSyBP-agFonqibwQaBBCQtoyvVzRQzgyR5fo",
authDomain: "diyhacks-c419f.firebaseapp.com",
databaseURL: "https://diyhacks-c419f.firebaseio.com",
projectId: "diyhacks-c419f",
storageBucket: "diyhacks-c419f.appspot.com",
messagingSenderId: "810032620059",
appId: "1:810032620059:web:c6c1c48cef2779166acebe",
measurementId: "G-C9Y54R9YB7"
};
//configures firestore
const admin = require('firebase-admin');
const functions = require('firebase-functions');
admin.initializeApp(functions.config().firebase);
let db = admin.firestore();
//setting up directory paths
app.use(express.static(__dirname + '/views/'))
app.use(express.static(__dirname + '/public/'))
app.use(express.static(__dirname + '/imgs/'))
app.listen(3000, () => {
console.log('listening on 3000')
})
// app.get('/', (req, res) => {
// HackInfo.find().toArray((err, data) => {
// if (err) throw err
// app.local
// res.render('index', {data: data})
// })
// })
// app.post('/hackPost', (req, res)=>{
// var title = req.body.title;
// var location = req.body.location;
// var description = req.body.description;
// var host = host
// var month = req.body.month;
// var days = req.body.days;
// var skills = req.body.skills;
// var info = {
// title : title,
// location : location,
// description : description,
// host : host,
// month : month,
// days : days,
// skills : skills
// }
// HackInfo.insertOne(info, function(err, collection){
// if(err){
// throw err;
// }
// console.log(info);
// console.log("Hackathon posted!");
// });
// return res.redirect('/');
// })
// var signups = []
// app.post('/signup', (req, res) => {
// var firstname = req.body.firstname;
// var lastname = req.body.lastname;
// var username = req.body.username;
// var email = req.body.email;
// var password = req.body.password;
// var skills = req.body.skills;
// // signups = [req.body.signups];
// var data = {
// firstname: firstname,
// lastname:lastname,
// username : username,
// email:email,
// password:password,
// skills: skills,
// // signups: signups,
// }
// //create function that
// UserInfo.insertOne(data,function(err, collection){
// if (err) throw err;
// console.log(data);
// console.log("Record inserted Successfullyyyyy");
// });
// return res.redirect('/');
// })
// app.post('/login', (req,res) => {
// var username = req.body.username;
// var password = req.body.password;
// var data = {
// username: username,
// password: password,
// }
// UserInfo.findOne({username: username}, function(err, user) {
// if(!user) {
// res.redirect('/');
// }
// if (user && user.password === password){
// res.redirect('/');
// }
// else {
// res.redirect('/');
// }
// });
// })
// function addUsertoHack(userId){
// signups.push(userId);
// }
// app.post('/submit', (req, res) => {
// var title = req.body.title;
// var month =req.body.month;
// var days = req.body.days;
// var location =req.body.location;
// var notes =req.body.notes;
// var skills = req.body.skills;
// var host = req.body.host;
// var host_id =req.body.host_id;
// var data = {
// title: title,
// month: month,
// days: days,
// location: location,
// notes: notes,
// skills: skills,
// host: host,
// host_id: host_id
// }
// HackInfo.insertOne(data,function(err, collection){
// if (err) throw err;
// console.log(data);
// console.log("Record inserted Successfullyyyyy");
// });
// return res.redirect('/');
// })