简体   繁体   中英

Sails.js, application file not generated

I'm new to Sails.js and are now working through some tutorials.

I have now created my Sails application and added a User model and controller. 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

Am I missing something or did I create the application wrong?

port and loglevel should be set in config/env/[production|development]

I think the name of the application is taken from the package.json if I'm not mistaken.

Sails have improved this setup. Now you should have an env folder under config with an environment config file. For example 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM