Category: Node.js

SailsJs on Cloud 9 SSH


Quick Note:

SailsJs on cloud9 works wonderfully until you try to lift sails on a different port than the c9 default.

Cloud9 tries to help us by setting PORT and IP environment variables that turn into ‘process.env.PORT’ and ‘process.env.IP’ in nodejs. This is actually very helpful for generic node and express apps, but sailjs has an expectation that you set the port in its configuration files, and these environment variables override those settings.

For example, I set my ports in the previous post about nginx and sails in the config/env/development.js file. This setting (PORT:5001)  works fine on locally installed sails projects but when trying to lift sails on my c9 ssh project everything failed miserably. The solution is simple, though not immediately obvious: remove the c9 environment variable. It has been a few days since I figured out that this environment variable exists and deleted it, and thus far there have been no unintended consequences.

On ubuntu the following command was all it took:

unset PORT

duh.

 

Configure Sails.js with Subdomains on Ubuntu


I have been learning node.js lately, and I have become particularly fond of the sails.js framework for spinning up quick MVC websites. I will probably do a series of posts on sails in the coming weeks, but for now I just wanted to get this small nugget of information out there for anyone that might need it.