-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
50 lines (40 loc) · 1.21 KB
/
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
43
44
45
46
47
48
49
50
var express = require('express');
var sass = require('node-sass');
var pkg = require('./package.json');
var app = express();
// https://github.com/visionmedia/express/blob/master/examples/ejs/index.js
app.engine('html', require('ejs').renderFile);
app.set('views', __dirname + '/views');
app.set('view engine', 'html');
// https://github.com/andrew/node-sass
app.use(sass.middleware({
src: __dirname + '/sass',
dest: __dirname,
debug: true,
force: true
}));
app.use('/css', express.static(__dirname + '/css'));
app.use('/js', express.static(__dirname + '/js'));
app.use('/img', express.static(__dirname + '/img'));
app.use('/data', express.static(__dirname + '/data'));
var title = 'App Title | AxisPhilly';
app.get('/', function(req, res){
res.render('index', {
title: title,
env: app.settings.env,
version: pkg.version
});
});
app.get('/embed', function(req, res){
res.render('embed', {
title: title,
env: app.settings.env,
version: pkg.version
});
});
var port = process.env.PORT || 3000;
app.listen(port);
console.log('Express started on port ' + port);
console.log('App version: ' + pkg.version);
// make the express server available when this file is required
module.exports = app;