-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (27 loc) · 1.1 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
var fs = require('fs');
var db = require('./models/db');
var express = require('express');
var app = express();
var path = require('path');
var compression = require('compression');
var controllers = require('./controllers');
var bodyParser = require("body-parser");
var schedule = require("./schedule");
// var favicon = require('serve-favicon');
var obj;
var yearInMs = 31536000000;
var dotenv = require('dotenv');
// There's no need to check if .env exists, dotenv will check this // for you. It will show a small warning which can be disabled when // using this in production.
dotenv.load();
app.use(compression());
app.enable('trust proxy');
//Here we are configuring express to use body-parser as middle-ware.
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static('public'/*, { maxAge: yearInMs }*/));
// app.use(favicon(path.join(__dirname,'public','images','favicon.ico')));
app.use(controllers);
// app.get('/', function (req, res){
// res.sendFile(path.join(__dirname+'/public/index.html'), { maxAge: yearInMs });
// });
app.listen(process.env.PORT || 3000);