forked from JuanCanham/Apollo-Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apollo.js
49 lines (39 loc) · 1.29 KB
/
apollo.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
'use strict';
//pagekite.py 3000 apollomusic.pagekite.me
// Module dependencies
var express = require('express'),
http = require('http'),
path = require('path'),
routes = require('./routes'),
config = require('./config'),
auth = require('./controllers/auth');
// Create server
var app = express();
var server = http.createServer(app);
auth.init(app);
// Configure server
app.set('hostname', config.server.host);
app.set('port', config.server.port);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.compress());
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.cookieParser());
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.session({ secret: 'fartknockers', cookie: { maxAge: 3600000000 }}));
app.use(auth.passport.initialize());
app.use(auth.passport.session());
app.use(app.router);
app.locals.pretty = config.htmlPretty;
app.use(express.static(path.join(__dirname, 'public')));
app.use(function (req, res) {
res.status(404).render('404', {title: 'Not Found :('});
});
app.use(express.errorHandler());
server.listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
routes(app,auth,server);
});