首页 > 解决方案 > 如何使用 url 进行快速路由

问题描述

我阅读了快速指南以尝试了解如何做到这一点,但是如果我有我的网站并且在 url 中,表单是 [site url]/home 或 [site url]/profile 我如何制作它以便 url 实际上显示像那。现在它的 [site url]/pathtohome.html 代替。我正在使用快递服务器。

app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res) {
    res.sendFile(path.join(__dirname + '/public/index.html'))
})

标签: javascriptnode.jsexpress

解决方案


推荐阅读