-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
77 lines (52 loc) · 1.37 KB
/
app.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
//
//
//
//
var config = require('./config')
var express = require('express');
var app = express();
var passport = require('passport');
var hbs = require('hbs');
app.configure(function() {
app.use(express.static('public'));
app.use(express.cookieParser());
app.use(express.json());
app.use(express.urlencoded());
// app.use(require('connect-multipart')());
app.use(express.bodyParser());
app.use(express.session({ secret: 'keyboard blah' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
});
//TEMP USE Bookshelf
var Bookshelf = require('bookshelf');
Bookshelf.PG = Bookshelf.initialize({
client: config.db.type,
connection: {
host : config.db.host,
user : config.db.user,
password : config.db.password,
charset : 'utf8'
}
} );
//END TEMP
//module style:
//var db = require('./lib/db');
var aaa = require('./lib/aaa');
var User = require('./lib/User');
//app.use(db);
app.use(aaa);
app.use(User);
//User.forge({item: 'value'}).save();
app.set('view engine', 'html');
app.engine('html', hbs.__express);
app.get('/',
aaa.ensureAuthenticated,
function(req, res) {
// res.json({ id: req.user.id, username: req.user.username });
res.render('template_index');
}
);
app.listen(config.web.port);