-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
37 lines (31 loc) · 1.21 KB
/
server.js
File metadata and controls
37 lines (31 loc) · 1.21 KB
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
37
var application_root = __dirname,
express = require("express"),
path = require("path"),
routes = require("./routes");
var app = express.createServer();
app.configure(function(){
app.use(express.bodyParser());
app.use(app.router);
app.set('view engine', 'ejs');
app.set('view options', { layout: false });
app.register('.html', require('ejs'));
});
app.configure('development', function(){
app.use(express['static'](path.join(application_root, "public")));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
var oneYear = 31557600000;
app.use(express['static'](path.join(application_root, "public"), { maxAge: oneYear }));
app.use(express.errorHandler());
});
app.get('/', routes.getIndex);
app.put('/users/:username', routes.createUser);
app.put('/projects/:projectId', routes.modifyProject);
app.get('/projects', routes.getAllProjects);
app.get('/reports/projecttotals', routes.getProjectTotals);
app.get('/projects/:projectName', routes.getProject);
app.post('/projects/:projectName', routes.updateProject);
app.post('/projects/', routes.createNewProject);
app['delete']('/projects/:projectId', routes.deleteProject);
app.listen(3000);