-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (27 loc) · 890 Bytes
/
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
34
35
var express = require('express');
var app = express();
var morgan = require('morgan');
var bodyParser = require('body-parser');
var nunjucks = require('nunjucks');
var path = require('path');
var models = require('./models');
var routes=require('./routes');
var route = models.Page.urlTitle;
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, '/public')));
app.use(routes);
//syncing/integrating tables w/app + server
models.db.sync({force:true})
.then(()=>{
console.log('Page Table created!');
app.listen(3000, ()=>{
console.log('Server is listening on port 3000!');
})
})
.catch(console.error.bind(console));
//why are we binding here?
const env = nunjucks.configure('views', {noCache: true});
app.set('view engine', 'html');
app.engine('html', nunjucks.render);