mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: add router and css
This commit is contained in:
1 parent
cc95bb195b
commit
abf1ecddb4
4 files changed
+22
-2
No files matched your search
@@ -0,0 +1,9 @@
|
|||||||
|
table,
|
||||||
|
tr,
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
width: 50%;
|
||||||
|
border: 2px solid black;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import connectDB from '@linux-odyssey/models'
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { engine } from 'express-handlebars'
|
import { engine } from 'express-handlebars'
|
||||||
import config from './config.js'
|
import config from './config.js'
|
||||||
import { homeController } from './controllers/index.js'
|
import router from './router.js'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await connectDB(config.db)
|
await connectDB(config.db)
|
||||||
@@ -13,7 +13,8 @@ async function main() {
|
|||||||
app.set('view engine', 'handlebars')
|
app.set('view engine', 'handlebars')
|
||||||
app.set('views', './views')
|
app.set('views', './views')
|
||||||
|
|
||||||
app.get('/', homeController)
|
app.use(router)
|
||||||
|
app.use(express.static('./public'))
|
||||||
|
|
||||||
app.listen(3001, () => {
|
app.listen(3001, () => {
|
||||||
console.log('Server started on http://localhost:3001')
|
console.log('Server started on http://localhost:3001')
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Router } from 'express'
|
||||||
|
|
||||||
|
import { homeController } from './controllers/index.js'
|
||||||
|
|
||||||
|
const router = Router()
|
||||||
|
|
||||||
|
router.get('/', homeController)
|
||||||
|
|
||||||
|
export default router
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
|
<link rel='stylesheet' href='/css/style.css' />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{{body}}}
|
{{{body}}}
|
||||||
|
|||||||
Reference in new issue
Block a user