-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (31 loc) · 1.14 KB
/
index.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
var express = require('express');
var app = express();
var swig = require('swig');
var bodyParser = require('body-parser');
var path = require('path');
var sassMiddleware = require('node-sass-middleware');
var autoprefixer = require('express-autoprefixer');
var location = require('./modules/location');
require('dotenv').load();
app.engine('html', swig.renderFile);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
app.set('view cache', false);
swig.setDefaults({ cache: false });
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(sassMiddleware({
src: path.join(__dirname, 'stylesheets'),
dest: path.join(__dirname, 'public', 'css'),
debug: false,
prefix: '/css',
outputStyle: 'compressed'
}));
app.use(autoprefixer({ browsers: 'last 2 versions', cascade: false }));
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', require('./routes'));
var server = app.listen(process.env.PORT || 3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Splore is listening at http://%s:%s', host, port);
});