javascript - 如何使用 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'))
})
解决方案
推荐阅读
- google-bigquery - 如何在大查询中使用 ST_CONTAINS 加入地理列
- pandas - 无法使用 pip 安装 pandas 升级 numpy、6 和 python-dateutil 时出现问题
- javascript - JavaScript:从一个表格主体淡入到另一个表格主体
- python-3.x - Python 从同一项目中的更高目录导入
- python - 如何在 matplotlib 中为多个图格式化 x 轴
- android-sdk-manager - 当我尝试执行任何命令时,Android SDK [控制台工具] 仅显示“使用”帮助信息
- c - 强制转换中 const 说明符的必要性
- php - 如何从 Laravel 项目中的 GraphQL 模式调用 Eloquent 动态范围(带 1 个参数)?
- python - 无法使用 pynput 打印大写字母或括号
- c# - API 入口点无法识别 JSON (TypeScript) 的元组数组