javascript - Add sails route path to default URL
问题描述
I have a node
server that uses Sails framework.
When I run, it returns this message:
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.
Is possible to add a route path to the default URL?
Instead of http://localhost:1337
, use http://localhost:1337/test/
I tried to run with npm start sails lift --appPath=/test/
but does not do anything.
解决方案
如果您希望 Sails.js 在测试期间提升到特定页面,您可以创建一个新的视图操作(或者view-homepage-or-redirect
如果您下载了应用程序,则使用)然后在操作中您可以设置
if (sails.config.environment !== 'production') {
throw {redirect:'/test'};
}
如果你最终为此做了一个新动作,别忘了把它添加到你的routes.js
推荐阅读
- ios - [Swift]我无法从特定 URL 获取任何 JSON 数据
- python - 返回一个数字是否为素数作为 Python 中的布尔值
- javascript - 由于滥用状态,数组未动态更新
- ffmpeg - 从实时 youtube 流中提取帧
- javascript - 为什么此代码在松散相等而不是严格相等时正确运行?
- reactjs - 无法在 HOC 中将钩子用于功能组件
- ios - iOS提交:无效二进制:禁止指令
- google-bigquery - Bigquery中的openstreet地图数据集中缺少美国几何
- javascript - ReferenceError:logInModule 未在 HTMLElement.onclick 中定义
- mysql - 在最后一步安装 Mysql 时出现问题,需要很长时间