-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.js
34 lines (26 loc) · 847 Bytes
/
service.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
var express = require('express');
var routes = require('./routes');
var http = require('http');
var controllers = require('./api');
var bodyParser = require("body-parser");
var app = express();
app.set('port', process.env.PORT || 3000);
app.use(express.static(__dirname + '/public'));
app.use("/node_modules", express.static('node_modules'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
//app.use('/', require('./routes/routes.js'));
//app.all('/*', function (request, response, next) {
// if (request.method == 'OPTIONS') {
// response.status(200).end();
// } else {
// next();
// }
//});
// Map the routes
controllers.init(app);
app.get('/', routes.index);
http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});