You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
664 B
29 lines
664 B
var express = require('./node_modules/express'); |
|
var cons = require('./node_modules/consolidate'); |
|
var swig = require('./node_modules/swig'); |
|
|
|
var app = express(); |
|
|
|
// swig integration |
|
var template_dir = __dirname + "/templates"; |
|
console.log('Templates = ' + template_dir); |
|
|
|
app.engine('.html', cons.swig); |
|
app.set('view engine', 'html'); |
|
|
|
swig.init({ |
|
root: template_dir, |
|
allowErrors: true |
|
}); |
|
app.set('views', template_dir); |
|
|
|
// static |
|
app.use('/static', express.static(__dirname + '/static')); |
|
|
|
// routes |
|
app.get('/', function(req, res) { |
|
res.render('index.html', { variable: 'value'} ); |
|
}); |
|
|
|
app.listen(5500); |
|
console.log('Running on port 5500...'); |