Bind sails.js app to a specific ip

女生的网名这么多〃 提交于 2020-01-16 00:28:24

问题


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?


回答1:


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




回答2:


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>';



来源:https://stackoverflow.com/questions/26208664/bind-sails-js-app-to-a-specific-ip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!