-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (26 loc) · 803 Bytes
/
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
const express = require('express'),
settings = require('./settings.json'),
{ Liquid } = require('liquidjs');
var app = express()
app.use(express.json({ limit: '2MB'}))
app.use(express.urlencoded())
const engine = new Liquid({
root: './views/',
extname: '.liquid',
globals: {
settings: settings,
}
});
app.get("/engineRender", (req, res, next) => {
engine.renderFile('index.liquid')
.then((result) => {
res.send(result)
});
})
app.get("/resRender", (req, res, next) => {
res.render('index.liquid');
})
// register liquid engine
app.engine('liquid', engine.express());
app.set('view engine', 'liquid'); // set liquid to default
app.listen(3000, () => console.log('app listening on port 3000!'))