Sails.js Basics and Installation Last Updated : 06 Sep, 2020 Comments Improve Suggest changes Like Article Like Report Node.js: Node.js is an open-source and cross-platform runtime environment for executing JavaScript code outside a browser. You need to remember that NodeJS is not a framework and it’s not a programming language. Most of the people are confused and understand it’s a framework or a programming language. We often use Node.js for building back-end services like APIs like Web App or Mobile App. Sails.js: Sails.js is a Node.js framework that is built on top of Express.js and a real-time Model-View-Controller(MVC) framework for Node.js. Sails are alike to Ruby on Rails. It enables developers to rapidly assemble REST APIs, single-page apps, and many more. Sails.js is a flawless JavaScript solution that underpins varied front-end technologies and multiple databases concurrently. 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 npm init in our project directory 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 Installing sails 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: new sails project 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 Starting server via sails In the browser on localhost:1337 port, we get the below-rendered brand new homepage: Final setup Reference: https://sailsjs.com/get-started Comment More infoAdvertise with us Next Article Sails.js Basics and Installation A amitkumarjee Follow Improve Article Tags : Web Technologies Node.js Node.js-Misc Similar Reads How local installation of a dependency done ? The local installation of dependencies in Node.js is done by putting the local dependencies in a single place and running some simple commands from the terminal to install dependencies. A local dependency can't be accessed outside of the directory. All the local dependencies of a project are usually 2 min read Express.js | app.path() Function The app.path() function returns the canonical path of the app as a string. When mounting advanced apps, the behavior of this approach can become extremely complicated. In most cases, it is better to use req.baseUrl to obtain the app's canonical path. Installation of the express module: You can visit 2 min read Express.js res.download() Function The res.download() function transfers the file at the path as an 'attachment'. Typically, browsers will prompt the user to download.Syntax:res.download(path [, filename] [, options] [, fn])Parameters: The filename is the name of the file which is to be downloaded as an attachment and fn is a callbac 2 min read Express.js | app.param() Function The app.param() function is used to add the callback triggers to route parameters. It is commonly used to check for the existence of the data requested related to the route parameter. Syntax: app.param([name], callback) Parameters: name: It is the name of the parameter or an array of them.callback: 2 min read Introduction to packages and modules in npm The Node Package Manager (npm) serves as a tool for the JavaScript programming language functioning both as a command line utility and package manager. It is the choice for managing dependencies and sharing packages within the NodeJS environment. The public npm registry acts as a centralized platfor 4 min read Like