forked from Joshua-Inkyu-Heo/shortly-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server-config.js
executable file
·34 lines (25 loc) · 953 Bytes
/
server-config.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 partials = require('express-partials');
var util = require('./lib/utility');
var handler = require('./lib/request-handler');
var app = express();
app.configure(function() {
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(partials());
app.use(express.bodyParser());
app.use(express.static(__dirname + '/public'));
app.use(express.cookieParser('shhhh, very secret'));
app.use(express.session());
});
app.get('/', util.checkUser, handler.renderIndex);
app.get('/create', util.checkUser, handler.renderIndex);
app.get('/links', util.checkUser, handler.fetchLinks);
app.post('/links', handler.saveLink);
app.get('/login', handler.loginUserForm);
app.post('/login', handler.loginUser);
app.get('/logout', handler.logoutUser);
app.get('/signup', handler.signupUserForm);
app.post('/signup', handler.signupUser);
app.get('/*', handler.navToLink);
module.exports = app;