Bootstrap FreeKB - Sails - Create a new Sails app using the sails new command
Sails - Create a new Sails app using the sails new command

Updated:   |  Sails articles

This assumes you have installed Sails. The sails new command can be used to install an app into your present working directory. In this example, an app named foo-app will be installed.

sails new foo-app

 

When prompted to choose a template, it usually makes sense to select Web App.

Choose a template for your new Sails app:
 1. Web App  ·  Extensible project with auth, login, & password recovery
 2. Empty    ·  An empty Sails app, yours to configure
 (type "?" for help, or <CTRL+C> to cancel)
?

 

Or, if you do not want an interactive prompt, echo 1 can be used to create a Web App.

echo 1 | sails new foo-app

 

Or echo 1 can be used to create an Empty app.

echo 2 | sails new foo-app

 

If the app was successfully created, something like this should be returned.

info: Created a new Sails app `foo-app`!

 

And there should be a directory for the app that contains files and directories.

~]# ls -l foo-app/
drwxr-xr-x.   8 root root    100 Jul 21 22:58 api
-rw-r--r--.   1 root root   1841 Jul 21 22:58 app.js
drwxr-xr-x.   8 root root    130 Jul 21 22:58 assets
drwxr-xr-x.   4 root root   4096 Jul 21 22:58 config
-rw-r--r--.   1 root root    669 Jul 21 22:58 Gruntfile.js
drwxr-xr-x. 512 root root  16384 Jul 21 22:58 node_modules
-rw-r--r--.   1 root root   6133 Jul 21 22:58 package.json
-rw-r--r--.   1 root root 369612 Jul 21 22:58 package-lock.json
-rw-r--r--.   1 root root   1720 Jul 21 22:58 README.md
drwxr-xr-x.   2 root root     34 Jul 21 22:58 scripts
drwxr-xr-x.   4 root root     55 Jul 21 22:58 tasks
drwxr-xr-x.   5 root root    110 Jul 21 22:58 views

 

The --no-frontend flag can be used to create an app without a front end.

sails new bar-app --no-frontend

 

Likewise, the --minimal flag can be used to create a minimal app.

sails new bar-app --minimal

 

In these scenarioa, the bar-app directory should contain the following files and directories.

~]# ls -l bar-app/
drwxr-xr-x.   8 root root    100 Jul 21 22:58 api
-rw-r--r--.   1 root root   1841 Jul 21 22:58 app.js
drwxr-xr-x.   4 root root   4096 Jul 21 22:58 config
drwxr-xr-x. 512 root root  16384 Jul 21 22:58 node_modules
-rw-r--r--.   1 root root   6133 Jul 21 22:58 package.json
-rw-r--r--.   1 root root 369612 Jul 21 22:58 package-lock.json
-rw-r--r--.   1 root root   1720 Jul 21 22:58 README.md

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter bc5b6f in the box below so that we can be sure you are a human.