-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (26 loc) · 912 Bytes
/
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
const express = require('express');
const routes = require('./routes/routes.js');
const app = express();
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser')
const session = require('express-session');
const morgan = require('morgan')
const cors = require('cors');
app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(cookieParser());
app.use(session({
secret: "some secret key",
resave: false,
saveUninitialized: true,
cookie: { secure: false },
}))
app.use(morgan('tiny'))
app.get('/', (req, res) => res.send('Hello, World'))
app.get('/example/:example', routes.example_db)
console.log('Authors: Neil Shweky (nshweky)');
const port = process.env.PORT || '8080';
app.listen(port, () => {
console.log('Server running on port ' + port + '. Now open http://localhost:' + port + '/ in your browser!');
});