mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: new analytics package, setup template
This commit is contained in:
1 parent
bd3d463280
commit
fb687094ee
7 files changed
+224
-11
No files matched your search
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ext": "js,handlebars"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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')
|
||||
})
|
||||
@@ -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>
|
||||
Reference in new issue
Block a user