简体   繁体   中英

Bind sails.js app to a specific ip

I have a Nodejs project and is using sails.js mvc framework. Now, Im ready to deploy it, but before that one requirement is to bind it to a different ip. Is there a way on sails.js that we can achieve this? What file or config should I update?

You have to change the 'host' key. Source

You can change the /config/local.js file and add the 'host' key to it :

{
    port: '1234',
    host: '111.111.111.111',
    environment: 'production'
}

Source

I've tried @xShirase answer and it worked too. So I have it marked as answer. Anyhow, this is what I did on my end:

I added application.js on config, config/application.js then added this line module.exports.host = '<ip here>';

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