mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: connect analytics to mongo
This commit is contained in:
1 parent
fb687094ee
commit
add6bfd100
3 files changed
+22
-11
No files matched your search
@@ -10,6 +10,7 @@
|
||||
"dev": "nodemon src/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@linux-odyssey/models": "*",
|
||||
"express": "^4.18.2",
|
||||
"express-handlebars": "^7.1.2"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
db: process.env.MONGO_URL || 'mongodb://localhost:27017/odyssey-test',
|
||||
}
|
||||
@@ -1,17 +1,24 @@
|
||||
import connectDB from '@linux-odyssey/models'
|
||||
import express from 'express'
|
||||
import { engine } from 'express-handlebars'
|
||||
import config from './config.js'
|
||||
|
||||
const app = express()
|
||||
async function main() {
|
||||
await connectDB(config.db)
|
||||
const app = express()
|
||||
|
||||
// Setting up Handlebars as templating engine
|
||||
app.engine('handlebars', engine())
|
||||
app.set('view engine', 'handlebars')
|
||||
app.set('views', './views')
|
||||
// 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.get('/', (req, res) => {
|
||||
res.render('home', { title: 'Linux Odyssey Admin' })
|
||||
})
|
||||
|
||||
app.listen(3001, () => {
|
||||
console.log('Server started on http://localhost:3001')
|
||||
})
|
||||
app.listen(3001, () => {
|
||||
console.log('Server started on http://localhost:3001')
|
||||
})
|
||||
}
|
||||
|
||||
main().catch(console.error)
|
||||
Reference in new issue
Block a user