-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi_app.js
36 lines (28 loc) · 1 KB
/
api_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
/******************************************************************
* Copyright (c) 2018 Daniel Eynis, Bishoy Hanna, Bryan Mikkelson,
* Justin Moore, Huy Nguyen, Michael Olivas, Andrew Wood
* This program is licensed under the "MIT License".
* Please see the file LICENSE in the source
* distribution of this software for license terms.
/******************************************************************/
var express = require('express');
var config = require('./local_modules/config');
var router = express.Router({
});
var bodyParser = require('body-parser');
var api = require('./routes/api');
var app = express();
app.use(bodyParser.text());
app.use('/api', api);
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handler
app.use(function(err, req, res, next) {
console.log(err);
res.status(err.status || 500);
res.send('Internal Server Error');
});
module.exports = app;