Signup MongoLab

First of all you need to create a new account at MongoLab. After created account you need to create a new deployment in Mongolab. Make sure you have selected free sandbox

You also need to create a new database with this new sandbox.

Create a new User

 

To connect MongoLab with Sails.js . You need to create a new user .

Create new Connection in Sails

Now you have to create a new connection in sails.js app. First of all you need to install mongodb driver

Open your connections.js  file in Sails.js app. Create a new mongoLabServer connection object

 

To connect Sails.js app to MongoLab you need to use your mongo uri

After created connection you need to tell your default connection to sails.js app. Open models.js from config/models.js and add mongoLabServer connection to models object.

 

Run your sails project

Your project will be running on PORT 1337 . You sails app has been connected to MongoLab

 

If you want to learn more about Sails.js and Node.js. I have created a new course Udemy. Here is the link of my course

Nodejs: Building Rest Apis with Sails.js