feat: add router and css

This commit is contained in:
wancat committed 2023-10-14 16:17:47 +08:00
1 parent cc95bb195b
commit abf1ecddb4
4 files changed
+22 -2

No files matched your search

+3 -2
View File
@@ -2,7 +2,7 @@ import connectDB from '@linux-odyssey/models'
import express from 'express'
import { engine } from 'express-handlebars'
import config from './config.js'
import { homeController } from './controllers/index.js'
import router from './router.js'
async function main() {
await connectDB(config.db)
@@ -13,7 +13,8 @@ async function main() {
app.set('view engine', 'handlebars')
app.set('views', './views')
app.get('/', homeController)
app.use(router)
app.use(express.static('./public'))
app.listen(3001, () => {
console.log('Server started on http://localhost:3001')
+9
View File
@@ -0,0 +1,9 @@
import { Router } from 'express'
import { homeController } from './controllers/index.js'
const router = Router()
router.get('/', homeController)
export default router