-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (25 loc) · 890 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
30
31
32
33
34
35
36
(function () {
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const http = require('http');
const db = require('./models/db');
const logger = require('./log');
const router = require('./router/userRouter');
const port = process.env.PORT || 3000;
process.env.DEBUG = 'phaser:debug';
var app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.post('/adduser', function (req, res) {
res.setHeader('Content-Type', 'application/json');
router.addUser(req, res);
});
// Creating a server at port
http.createServer(app).listen(port, () => {
logger.trace(`Express server listening on port ${port}`);
});
}());