-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.js
More file actions
executable file
·36 lines (30 loc) · 1.2 KB
/
Copy pathrouter.js
File metadata and controls
executable file
·36 lines (30 loc) · 1.2 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
var express = require('express'),
app = express(),
config = require('./config/config').configure(app),
http = require('http'),
app_routes = require('./app/routes/application'),
auth_routes = require('./app/routes/authentication'),
router = require('./app/routes/router')
dotHelpers = require('./app/dot/helpers');
app.use(function(req, res, next) {
res.locals = {
dot: dotHelpers,
messages: req.flash()
};
next();
});
router.bootstrap(app);
app.get('/login', app_routes.login);
app.get('/', auth_routes.isAuthenticated, app_routes.home);
app.get('/create', app_routes.createUser);
app.get('/user/update', auth_routes.isAuthenticated, app_routes.updateUser);
app.get('/logout', app_routes.logout);
//local authentication routes
app.post('/user/create', auth_routes.localCreate);
app.post('/user/delete', auth_routes.isAuthenticated, auth_routes.localDelete);
app.post('/user/update', auth_routes.isAuthenticated, auth_routes.localUpdate);
app.post('/user/password', auth_routes.isAuthenticated, auth_routes.localPasswordUpdate);
app.post('/login', auth_routes.localAuthentication);
// 404 catchall
app.use(app_routes.catchall);
http.createServer(app).listen(3000);