【发布时间】:2016-12-15 00:12:35
【问题描述】:
我正在使用 MEAN 堆栈构建博客应用程序,我有一些路由查询数据库中的帖子,然后使用 pug.js 模板引擎呈现它们。路线看起来像
router.get('/:name', function(req, res) {
//logic querying mongodb using name as
//req.params.id to search for a specific author of the posts and rendering
})
这可行,但是当我想使用 router.get'/contact'、函数等渲染我的联系人页面时...
它尝试查询联系人而不是呈现contact.pug 文件,我该怎么做才能让这些页面呈现?
【问题讨论】:
-
如果不查看整个路由,就很难准确地看到自己在做什么
标签: javascript express