mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
convert analytics to TS
This commit is contained in:
1 parent
9509bbc355
commit
ece0ec7c41
25 files changed
+11595
-661
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import connectDB from '@linux-odyssey/models'
|
||||
import express from 'express'
|
||||
import { engine } from 'express-handlebars'
|
||||
import basicAuth from 'express-basic-auth'
|
||||
import config from './config.ts'
|
||||
import router from './router.ts'
|
||||
|
||||
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')
|
||||
|
||||
app.use(
|
||||
basicAuth({
|
||||
users: { [config.username]: config.password },
|
||||
challenge: true,
|
||||
realm: 'Linux Odyssey Admin Dashboard',
|
||||
})
|
||||
)
|
||||
app.use(router)
|
||||
app.use(express.static('./public'))
|
||||
|
||||
app.listen(config.port, config.host, () => {
|
||||
console.log(`Server started on ${config.baseUrl}`)
|
||||
})
|
||||
}
|
||||
|
||||
main().catch(console.error)
|
||||
Reference in new issue
Block a user