Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Sails js in cloud-9 ide

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.

like image 480
Jayanth Avatar asked Oct 31 '14 06:10

Jayanth


People also ask

What tools are included in the AWS Cloud9 IDE?

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.

How do I run Node JS on AWS Cloud9?

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.

How do I deploy my Sails app to production?

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.

How do I run a Node JS application on idle?

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 ).)


1 Answers

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/
like image 155
Fabian Jakobs Avatar answered Sep 19 '22 13:09

Fabian Jakobs