forked from denghongcai/forsaken-mail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
29 lines (21 loc) · 605 Bytes
/
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
/**
* Created by Hongcai Deng on 2015/12/28.
*/
'use strict';
let express = require('express');
let path = require('path');
let debug = require('debug')('app');
let bodyParser = require('body-parser');
let api = require(path.join(__dirname, 'routes/api'));
let app = express();
app.set('x-powered-by', false);
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public'), { maxAge: 3600000}));
app.use('/api', api);
app.use(function(req, res, next) {
let err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use(err => debug(err));
module.exports = app;