-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (21 loc) · 696 Bytes
/
server.js
File metadata and controls
26 lines (21 loc) · 696 Bytes
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
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');
var app = express();
var server = require('http').createServer(app);
var protectJSON = require('./lib/protectJSON');
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(protectJSON);
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
app.use('/', require('./routes'));
// If no route is matched, it must be 404
app.use(function(req, res, next){
res.status(404).end();
});
var port = (process.env.PORT || 5555);
server.listen(port);
console.log('listening on: ' + port);