*Yoink*
parent
1303686575
commit
3e999d9d46
|
@ -1,10 +1,20 @@
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
import { Liquid } from "liquidjs";
|
||||||
|
const engine = new Liquid();
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 3430;
|
const port = 3430;
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.engine('liquid', engine.express());
|
||||||
res.send("Hello wold!");
|
app.set('views', ['./partials', './views']);
|
||||||
});
|
app.set('view engine', 'liquid');
|
||||||
|
|
||||||
|
app.get('/', function (req, res) {
|
||||||
|
const todos = ['fork and clone', 'make it better', 'make a pull request']
|
||||||
|
res.render('todolist', {
|
||||||
|
todos: todos,
|
||||||
|
title: 'Welcome to liquidjs!'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log('✅ Webserver started on port ', port)
|
console.log('✅ Webserver started on port ', port)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>{{title}}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>{{title}}</h1>
|
||||||
|
|
||||||
|
{% block %}{% endblock %}
|
||||||
|
|
||||||
|
<footer> {% block footer %}{% endblock %} </footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1 @@
|
||||||
|
{{id}} - {{todo}}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{% layout 'layout' %}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{% for todo in todos %}
|
||||||
|
<li>{% include 'todo', id:forloop.index %}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% block 'footer' %}
|
||||||
|
Copyright @ 2016, Harttle
|
||||||
|
{% endblock %}
|
|
@ -11,10 +11,12 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"express-session": "^1.17.3",
|
"express-session": "^1.17.3",
|
||||||
|
"liquidjs": "^9.42.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"terser": "^5.15.1"
|
"terser": "^5.15.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/ejs": "^3.1.1",
|
||||||
"@types/express": "^4.17.14",
|
"@types/express": "^4.17.14",
|
||||||
"eslint": "8.25.0",
|
"eslint": "8.25.0",
|
||||||
"eslint-config-next": "12.3.1",
|
"eslint-config-next": "12.3.1",
|
||||||
|
@ -223,6 +225,12 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/ejs": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-RQul5wEfY7BjWm0sYY86cmUN/pcXWGyVxWX93DFFJvcrxax5zKlieLwA3T77xJGwNcZW0YW6CYG70p1m8xPFmA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/express": {
|
"node_modules/@types/express": {
|
||||||
"version": "4.17.14",
|
"version": "4.17.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
|
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
|
||||||
|
@ -2250,6 +2258,22 @@
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/liquidjs": {
|
||||||
|
"version": "9.42.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-9.42.0.tgz",
|
||||||
|
"integrity": "sha512-krvhwGFrMCMGhybGkxJIvlWVVnoCSpYCn7NhEN43+uvlg2vOkYWpq8be+L3NMlOfwe4ZrKQ7hCh1EmS4yhLKow==",
|
||||||
|
"bin": {
|
||||||
|
"liquid": "bin/liquid.js",
|
||||||
|
"liquidjs": "bin/liquid.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.8.7"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/liquidjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/locate-path": {
|
"node_modules/locate-path": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||||
|
@ -3615,6 +3639,12 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/ejs": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-RQul5wEfY7BjWm0sYY86cmUN/pcXWGyVxWX93DFFJvcrxax5zKlieLwA3T77xJGwNcZW0YW6CYG70p1m8xPFmA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/express": {
|
"@types/express": {
|
||||||
"version": "4.17.14",
|
"version": "4.17.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
|
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
|
||||||
|
@ -5151,6 +5181,11 @@
|
||||||
"type-check": "~0.4.0"
|
"type-check": "~0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"liquidjs": {
|
||||||
|
"version": "9.42.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-9.42.0.tgz",
|
||||||
|
"integrity": "sha512-krvhwGFrMCMGhybGkxJIvlWVVnoCSpYCn7NhEN43+uvlg2vOkYWpq8be+L3NMlOfwe4ZrKQ7hCh1EmS4yhLKow=="
|
||||||
|
},
|
||||||
"locate-path": {
|
"locate-path": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"author": "nightlymania",
|
"author": "nightlymania",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/ejs": "^3.1.1",
|
||||||
"@types/express": "^4.17.14",
|
"@types/express": "^4.17.14",
|
||||||
"eslint": "8.25.0",
|
"eslint": "8.25.0",
|
||||||
"eslint-config-next": "12.3.1",
|
"eslint-config-next": "12.3.1",
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"express-session": "^1.17.3",
|
"express-session": "^1.17.3",
|
||||||
|
"liquidjs": "^9.42.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"terser": "^5.15.1"
|
"terser": "^5.15.1"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue