Running Sails js in cloud-9 ide

How can I run Sails.js in cloud-9 ide. I have a problem when I say

sail lift

it creates an instance of localhost: 8080 to run, but I have problems accessing it from the browser.

+5
source share
2 answers

In cloud 9, you need to go to the dynamic domain released for your workspace. Usually this

https://<WORK SPACE NAME>-c9-<YOUR USER NAME>.c9.io/ 

You can verify this by sailing, then click Preview โ†’ Preview with webserver

If your sails.js is configured as follows, then it will work on port 80 because cloud nine will indicate the port.

 port: process.env.PORT || XXXX, 

If instead you directly indicate your port, then it will be set to XXXX

 port: XXXX, 
+2
source

You need to configure the sails to use IP and port, as indicated in the Cloud9 $IP and $PORT environment variables.

Just change your config/env/development.js like this:

 module.exports = { port: process.env.PORT, host: process.env.IP }; 

Then you can start it using sails lift from the terminal. To open the application, simply click Preview -> Preview with web server on the toolbar or go to:

 https://<WORK SPACE NAME>-c9-<YOUR USER NAME>.c9.io/ 
+4
source

Source: https://habr.com/ru/post/1205925/


All Articles