-
Notifications
You must be signed in to change notification settings - Fork 5
/
server.js
68 lines (55 loc) · 1.56 KB
/
server.js
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
import express from 'express';
const app = express();
import mongoose from 'mongoose';
let uri = '';
if (process.env.NODE_ENV === 'production') {
uri = process.env.MONGOLAB_URI;
console.log('===PRODUCTION===');
} else {
uri = '127.0.0.1/express-boiler';
console.log('===DEVELOPMENT===');
}
mongoose.connect(uri, {}, (err)=> {
if (err) {
console.log('Connection Error: ', err);
} else {
console.log('Successfully Connected');
}
});
import routes from './routes';
// import ensureAuth from './passport/ensure-authenticated';
// import authHandler from './handlers/auth-handlers';
// import emailHandler from './handlers/email-handlers';
// let router = express.Router();
// // Check if user is already logged-in
// function checkIfLoggedIn(req, res, next) {
// if (!req.isAuthenticated()) {
// return next();
// }
// return res.redirect('/');
// }
// router.get('/api/register',
// checkIfLoggedIn,
// authHandler.getRegister);
// router.post('/api/register',
// checkIfLoggedIn,
// authHandler.register);
// router.get('/api/login',
// checkIfLoggedIn,
// authHandler.getLogin);
// router.post('/api/login',
// checkIfLoggedIn,
// authHandler.login);
// router.get('/api/logout',
// ensureAuth,
// authHandler.logout);
// router.get('/api/forgot-password',
// checkIfLoggedIn,
// authHandler.getForgotPassword);
// router.post('/api/send-new-password',
// checkIfLoggedIn,
// emailHandler.sendNewPassword);
let port = process.env.PORT || 4000;
app.listen(port, ()=> {
console.log('Server started at port number: ', port);
});