修改架构,移动端优先。

save
This commit is contained in:
cheney
2026-08-03 18:05:50 +08:00
committed by Cheney
parent 1c07b417ce
commit 08b3655a38
71 changed files with 2524 additions and 290 deletions
+19
View File
@@ -0,0 +1,19 @@
import { Router } from 'express'
import { authRequired } from '../middleware.js'
import { listArticles, getArticle } from '../articles.js'
const router = Router()
router.use(authRequired)
router.get('/articles', (_req, res) => {
res.json({ articles: listArticles() })
})
router.get('/articles/:slug', (req, res) => {
const article = getArticle(req.params.slug)
if (!article) return res.status(404).json({ error: '文章不存在' })
res.json({ article })
})
export default router