{ sailsit }

Sails Js Tutorials for Beginners and Forum

Have a Question?

If you have any question you can ask below or enter what you are looking for!

All posts tagged mongo

Raw Native Queries

1. Creating SailsJs Project Follow the below tutorial for setting up SailsJs Setting up sails project 2. Database Setup You can follow the below tutorial about setting up MySQL & MongoDb Setting up MySQL & MongoDB in SailsJs 3. Creating Models Use the below command to generate People model sails . . . Read more

Unit Testing with Mocha.js

Mocha.js is Javascript test framework, which can be used for writing unit test, and test your code. In this tutorial we will be writing unit tests for testing RestAPI built in SailsJs 1. Setting up project For this tutorial we will be using our sails-simple-crud project, which we can created . . . Read more

Schedule Jobs

1. Creating SailsJs Project Follow the below tutorial for setting up SailsJs Setting up sails project 2. Installing Packages For creating jobs we need to install sails-hook-jobs package, this package is available in npm. To install the package use the below command npm install sails-hook-jobs –save   3. Database Setup . . . Read more

Sails – Mongo ReplicaSet Configuration

In SailsJs, to configure replica set for MongoDB You can use MongoURI directly with all the details in your connnections.js file Below is the MongoURI format "mongodb://{replicaSet1}:{port},{replicaSet2}:{port},{replicaSetN}:{port}/{dbName}?replSet={replicaSetName}&readPreference=nearest&slaveOk=true"   The above URI then can be used in Sails config/connections.js as below mongoDB: { adapter: "sails-mongo", url: "mongodb://{replicaSet1}:{port},{replicaSet2}:{port},{replicaSetN}:{port}/{dbName}?replSet={replicaSetName}&readPreference=nearest&slaveOk=true" }

MongoDB and MySQL Configuration

1. Create new project You can follow this tutorial for setting up sails project Setting up Sails project 2. Installing Packages To use MySQL/MongoDB, first you need to install adapter for it Install sails-mongo adapter using npm. npm install sails-mongo –save   Install sails-mysql adapter using npm npm install sails-mysql . . . Read more

Model Functions – Waterline | REST API

SailsJs comes with WATERLINE (ORM) pre-installed, WATERLINE provides some Model functions which are used for querying database We will check usage of these Model functions in this tutorial with example codes 1. Create a Model names Movies using below command sails generate model Movies copy the below code in api/models/Movies.js . . . Read more

Simple CRUD Operations – REST API

1. Setting up SailsJS Environment First you need to setup Sails project. You can follow the guide on Sails official website Getting Started with SailsJS 2. Creating Project Run this command in any directory sails create sails-crud-simple This command will create new project with all the required dependencies 3. Setting . . . Read more