-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
53 lines (48 loc) · 1.06 KB
/
app.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
/**
* Module dependencies.
*/
const express = require("express"),
mongoose = require("mongoose"),
bodyParser = require("body-parser"),
session = require('express-session'),
cors = require("cors");
/**
* Dotenv evironment variables
*/
require('dotenv').config();
/**
* Route Handler
*/
let { mailchimp, checkIn } = require('./routes/index.js');
/**
* Create Express server.
*/
let app = express();
/**
* Express configuration.
*/
app.use(express.static(__dirname + "/public"));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(session({
cookieName: 'session',
secret: 'cow_the_milk',
duration: 30 * 60 * 1000,
activeDuration: 5 * 60 * 1000,
resave: false,
saveUninitialized: false,
maxAge: 60000
}));
app.use(cors());
/**
* Primary app routes.
*/
app.use(mailchimp);
app.use(checkIn);
/**
* Start Express server.
*/
let PORT = process.env.PORT || 8080;
app.listen(PORT, function() {
console.log("NODE server listening on port " + PORT);
});