[英]Sails.js, application file not generated
I'm new to Sails.js and are now working through some tutorials. 我是Sails.js的新手,现在正在学习一些教程。
I have now created my Sails application and added a User model and controller. 现在,我已经创建了Sails应用程序,并添加了一个User模型和控制器。 The application runs when executing sails lift.
该应用程序在执行风帆提升时运行。 I am able the view the users and create more.
我能够查看用户并创建更多。
I cannot find the below referenced file that is supposed to contain basic application settings such as application name, port, environment and log level. 我找不到以下引用的文件,该文件应该包含基本的应用程序设置,例如应用程序名称,端口,环境和日志级别。
config/application.js 配置/ application.js中
Am I missing something or did I create the application wrong? 我遗漏了一些东西还是创建了错误的应用程序?
port and loglevel should be set in config/env/[production|development]
端口和日志级别应在
config/env/[production|development]
I think the name of the application is taken from the package.json
if I'm not mistaken. 如果我没记错的话,我认为应用程序的名称来自
package.json
。
Sails have improved this setup. 帆改善了此设置。 Now you should have an env folder under config with an environment config file.
现在,您应该在config下有一个带有环境配置文件的env文件夹。 For example development.js
例如development.js
module.exports = {
port: 1337
};
This will set the port for that environment. 这将为该环境设置端口。 This environment is either set as the environment variable 'NODE_ENV' or you can specify this in your local.js file.
可以将此环境设置为环境变量“ NODE_ENV”,也可以在local.js文件中指定此环境。 Like so.
像这样
environment: development'
Note any variables set here can be accessed by using 注意这里设置的任何变量都可以通过使用
sails.config.variable
So you can set up your own appname variable and access it like that. 因此,您可以设置自己的appname变量并像这样访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.