Creating a new Sails project
Creating the blog application
Summary
Now that we have the Sails CLI installed, we will create our first Sails project.
Navigate to a directory where you want to create your project.
Run the following command to create a new Sails project:
sails new blog
The name "blog" is the project name.
The CLI will prompt you to choose a template:
Select Option 2 (Empty Sails app) so we can configure it from scratch.
Sails will generate the project and install dependencies. This may take a few minutes.
Once done, navigate into the project folder:
cd blog
Run
ls
(ordir
on Windows) to view the generated project files and folders.
In the next lesson, we will explore the Sails project structure and understand the purpose of each file and folder.
Transcript
Alright, so now that we have the Sails CLI installed, let's go ahead and create our very first Sails project.
To do this, navigate to a directory where you want to create your project. I've already navigated to my projects directory, but you can choose any folder you prefer.
Now, let's invoke the Sails CLI by typing:
sails new blog
This command tells Sails to create a new project named "blog". The CLI will then ask you to choose a template.
Since we want an empty Sails app, we should select option 2 and hit Enter. We don’t want the fully configured web app that includes authentication—we want to start from scratch in this course.
Sails will then generate the project and install the required dependencies. This may take a couple of minutes.
Once the process is complete, we will see a success message confirming that the blog project has been created.
Now, let's move into the project directory:
cd blog
We can take a quick look at the generated files and folders by running:
ls # (or `dir` on Windows)
This shows a couple of folders, a README.md, and a package.json file.
Congratulations! We have successfully created our first Sails application using the sails new
command.
In the next lesson, we’ll dive deeper into the Sails project structure to understand what each file and folder does.
Full Course
USD