-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathserver_base.js
31 lines (24 loc) · 905 Bytes
/
server_base.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
// This file defines the server setup that applies to dev, test and prod envs
const express = require('express');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const app = express();
const passport = require('./backend/passportConfig');
app.use(bodyParser.json());
app.use(cookieParser());
app.use(session({secret: 'react_intro',
resave: false,
saveUninitialized: false}));
app.use(passport.initialize());
app.use(passport.session());
app.use('/health', function(req, res, next) {
res.status(200).json({success: 'pong!'});
});
app.use('/api', function(req, res, next) {
require('./backend/app')(req, res, next);
});
// app.use('/api/login', function(req, res, next) {
// return res.status(200).json({loggedIn: false, username: null});
// });
module.exports = app;