-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
25 lines (21 loc) · 863 Bytes
/
server.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
var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var printJSON = require('./routes/printJSON');
var http = require('http');
var path = require('path');
var mongo = require('mongoskin');
var db = mongo.db('mongodb://localhost:27017/orders', {native_parser:true});
var app = express();
app.set('port', process.env.PORT || 8080);
app.use(express.favicon())
app.use(express.static(path.join(__dirname, 'static')));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.get('/demoQueue', routes.demoQueue);
app.get('/printJSON', printJSON.userlist(db));
app.post('/addUser', user.adduser(db));
app.delete('/deleteUser/:id', user.deleteuser(db));
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});