How can I run Sails.js in cloud-9 ide. The problem I have is when i say
sails lift
it creates a instance of localhost:8080 to run, but I have trouble accessing it from the browser.
AWS Cloud9 includes tools such as a code editor and terminal, plus a debugger for Node.js code. Because the AWS Cloud9 IDE is cloud based, you can work on your projects from your office, home, or anywhere using an internet-connected machine. For general information about AWS Cloud9, see the AWS Cloud9 User Guide.
In the AWS Cloud9 IDE, on the menu bar, choose Run, Run Configurations, New Run Configuration . On the [New] - Idle tab, choose Runner: Auto, and then choose Node.js . For Command, type hello.js 5 9.
Keep in mind that, most of the time, the process for deploying your Sails app is exactly the same as it would be for any other Node.js app. Just be sure to take a look at the other pages in this section of the docs (as well as your app's config/env/production.js file) and make any necessary adjustments before you actually deploy to production.
On the [New] - Idle tab, choose Runner: Auto, and then choose Node.js . For Command, type hello.js 5 9. In the code, 5 represents process.argv [2], and 9 represents process.argv [3]. ( process.argv [0] represents the name of the runtime ( node ), and process.argv [1] represents the name of the file ( hello.js ).)
You need to configure sails to use the IP and port as specified in the Cloud9 environment variables $IP
and $PORT
.
Just change your config/env/development.js
to look like this:
module.exports = {
port: process.env.PORT,
host: process.env.IP
};
Then you can run it with sails lift
from the terminal. In order to open the app just click Preview -> Preview with web server
in the toolbar or navigate to:
https://<WORK SPACE NAME>-c9-<YOUR USER NAME>.c9.io/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With