Sails.js Basics and Installation
Creating a basic Sails.js App via NPM(Node Package Manager)
Step 1: Make an empty project folder. In command prompt(cmd)/terminal, run npm init to initialize package.json file:
>> npm init -y // The -y can be added to gain default settings in package.json
Step 2: This usually takes about 48 seconds depending on your internet connection. You can optionally install nodemon for hot reloading. To install Sails.js.
>> npm install sails -g // The -g installs the library globally
Step 3: To generate a new app, just change directory (cd) into the directory where you want it to be, and type:
>> sails new sails-project
We’ll see a prompt to choose your project template as shown below:
Step 4: Type 1 (or press enter) to start with the default “Web App” template that includes essential features like login, password recovery, emails, and billing. Or, if you want to start from scratch with an empty project, choose 2 for a classic Sails app.
Once you’ve chosen your template, you’ll need to wait a moment for some dependencies to install. Then, to take a look at your new Sails app:
>> cd sails-project >> sails lift
In the browser on localhost:1337 port, we get the below-rendered brand new homepage: