-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
35 lines (29 loc) · 1.03 KB
/
app.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
'use strict';
var express = require('express');
var app = express();
var morgan = require('morgan');
var nunjucks = require('nunjucks');
var fs = require('fs');
var path = require('path');
var bodyParser = require('body-parser');
const models = require('./models');
//const userRouter = require('./user');
const routes = require('./routes')
//this is a test
// point nunjucks to the directory containing templates and turn off caching; configure returns an Environment
// instance, which we'll want to use to add Markdown support later.
const env = nunjucks.configure('views', {noCache: true});
// have res.render work with html files
app.set('view engine', 'html');
// when res.render works with html files, have it use nunjucks to do so
app.engine('html', nunjucks.render);
app.use(bodyParser());
app.use('/', routes);
models.db.sync({force: true})
.then(function () {
console.log('All tables created!');
app.listen(3000, function () {
console.log('Server is listening on port 3000!');
});
})
.catch(console.error.bind(console));