feat: new analytics package, setup template

This commit is contained in:
wancat committed 2023-10-14 16:03:44 +08:00
1 parent bd3d463280
commit fb687094ee
7 files changed
+224 -11

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
{
"ext": "js,handlebars"
}
+19
View File
@@ -0,0 +1,19 @@
{
"name": "analytics",
"version": "1.0.0",
"main": "index.js",
"private": true,
"type": "module",
"license": "GPL",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js"
},
"dependencies": {
"express": "^4.18.2",
"express-handlebars": "^7.1.2"
},
"devDependencies": {
"nodemon": "^3.0.1"
}
}
+17
View File
@@ -0,0 +1,17 @@
import express from 'express'
import { engine } from 'express-handlebars'
const app = express()
// Setting up Handlebars as templating engine
app.engine('handlebars', engine())
app.set('view engine', 'handlebars')
app.set('views', './views')
app.get('/', (req, res) => {
res.render('home', { title: 'Linux Odyssey Admin' })
})
app.listen(3001, () => {
console.log('Server started on http://localhost:3001')
})
+2
View File
@@ -0,0 +1,2 @@
<h1>Welcome to {{title}}</h1>
<p>This is the content of the homepage.</p>
@@ -0,0 +1,8 @@
<html>
<head>
<title>{{title}}</title>
</head>
<body>
{{{body}}}
</body>
</html>