Lesson 04
Lifting the Sails App
Summary
Lecture Summary: Starting Up a Sales App
In this lecture, we learn how to start a sales application called SalesQuickStart. This app was generated using the command SalesNew, SalesQuickStart
. The entry point for the app is the app.js file.
Starting the Sales Server
-
Lift the server:
- You can start the sales server by executing:
node app.js
- This starts the server in the development environment on port 1337.
- You can start the sales server by executing:
-
Accessing the App:
- Once the server is running, you can visit:
localhost:1337
- This will display the home page, which uses views/homepage.ejs and layout.ejs for rendering.
- Once the server is running, you can visit:
Other Methods to Start the Server
-
You can also start the server using a script in package.json:
- The script defined under "scripts" is start, which executes the command to lift the server.
- Run it with:
npm start
-
To stop the server, use Control+C in the terminal.
-
Alternatively, you can use the Sales command:
sales lift
Preferred Method
The preferred method for starting the server is using:
npm start
This ensures the application uses the Sales version specified in package.json, ensuring consistent behavior with the installed modules.
Conclusion
You now have a sales server running. Until next time, goodbye!
Video Transcript
In this lecture we're going to learn how to start up a sales app.
So we already have this sales app, SalesQuickStart, that was generated using SalesNew, SalesQuickStart,
remember?
So the entry point for the app is this file called app.js.
So you can simply say, nodeapp.js to lift the sales server.
Okay, so the sales server was lifted.
In sales they like to say lift, to mean it started.
So the server was lifted in the development environment with the part 1337.
It's like lead part anyway.
So now that the server is running, you can just go to localhost, localhost 1337.
And you're going to see this started page here.
You're looking at views slash homepage.ejs.
So this whole thing here is the layout.ejs and then they injected the views slash homepage.ejs.
So it tells you how to generate a REST API and all that stuff that we are going to do.
Okay?
Now there are other ways to lift the sales server.
So we did nodeapp.js, but if you look at the package.json, there's already that script
that calls nodeapp.js.
If you notice, go to package.json and notice there's under scripts, there's the start script
that does exactly what we did.
So you can also say npm start and that will call upon nodeapp.js.
All right?
To start.
So that's yet another way to, that's another way to lift the sales server.
Okay?
Now I can kill the server using control C in the terminal.
The signal to interrupt.
All right?
Now, to finalize just with yet another way of lifting the sales server.
Some people like calling the sales command sales followed by lift.
All right?
This way.
This also works.
Now the preferred way is I prefer calling the npm script.
That way it always uses the sales version that was defined in the package.json.
So my preferred way will always be this way, npm start.
All right?
This guy will make sure to use the sales version determined in the package.json because it's
already installed in the node modules and it's going to use the correct module instead
of the global one.
All right?
So that's it for this lecture.
You now have a sales server running and until the next time, bye.
No comments yet (loading...)
No comments yet (loading...)
Did you like the lesson? 😆👍
Consider a donation to support our work: