forked from joaoneto/oauth2orize-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
42 lines (30 loc) · 892 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var express = require('express'),
passport = require('passport');
// Init app
var app = module.exports = express();
var SessionStore = express.session.MemoryStore;
app.configure(function () {
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.methodOverride());
app.use(express.favicon());
app.use(express.session({
key: '_session',
secret: 'MYSecurityString',
store: new SessionStore(),
maxAge: 7200000
}));
app.use(passport.initialize());
app.use(app.router);
});
// OAuth server
var oauth2 = require('./oauth2')(app);
// Routes
var routes = require('./routes')(app);
app.post('/login', routes.login);
app.post('/logout', routes.logout);
app.get('/info', routes.info());
app.listen(3000, function () {
console.log('> NODE_ENV:', app.settings.env);
console.log('> Express server listening on port:', 3000);
});