In this lecture, we're going to start the server for our application, Angular will provide us with
a development server to locally preview our app in the browser.
It's important to note that this server is for development purposes, it's not suitable for production.
You may be questioning why we need a server in the first place.
Ultimately, angular is a front end framework.
A server is optional.
We can open files directly in the browser without a server delivering files.
However, it will be incredibly helpful when we start developing the master project for this course.
Browsers impose limitations on applications open directly in the browser.
We won't be able to make requests, upload files or and progressive web app features.
Therefore, it is better to serve an app with a server.
We don't have time to code a server, nor do we want to pay for one.
Luckily, we don't have to.
Angular provides us with a server that works on our local machines only we have access to this server.
Other developers won't be able to see what we're working on, which is fine during the development stages
of an app.
The server has other features.
It can monitor our files for changes.
If we change a single line of code, the app and the browser will refresh.
It's a time saver from having to do so ourselves.
This process happens lightning fast.
It comes with additional tooling for debugging an app.
The best part?
We don't need to configure the server.
It works out of the box.
This lets us focus on developing the application.
There is one downside to the server.
It's not meant for production.
It can work well for one to a few developers.
Once we start receiving significant traffic, it won't scale as well in a future section.
We will look at our options for servers when deploying our app.
For now, the development server will work for our purposes.
We can start the server with the Seelye.
Let's turn it on.
Be sure that you're inside your project's directory.
The command will search for a valid angular project before turning on the server inside the command
line.
We will type the N.G. Serve Command.
In some tutorials, some developers will recommend starting the server with the 21:00 start command
instead of the N.G. Serve Command, both commands are 100 percent identical.
Behind the scenes, the 21:00 Start Command will run the Nji Serve Command.
Feel free to use either one before running this command.
Let's check out additional information about it and the help option.
Once again, we're presented with an exhaustive list of options we can modify the port, enable SSL
or target a specific browser.
We don't need to provide this command with additional information.
We can run it as is.
Let's run the command without the help option.
After a few moments where presented with information about the server, the most important piece of
info is the URL to the app.
Let's check out the app in the browser.
Congrats, you've got a functioning, angular app.
You may see something slightly different than me, the default start page usually changes in future
versions of Angular.
Regardless, the app should be viewable in the browser.
If everything works, we can view the app via a URL called local host local host.
It's a special domain that points to your machine.
The browser will know to send the request to your machine.
Where Angular Development Server will intercept the request, it'll send back the page we see in the
browser.
Alternatively, the app can be visited with the IP 127.0.0.1.
Either URL works after the domain.
We have a port.
The port is written with a colon, followed by the port number.
You can think of a port as a door to a house.
Homes have multiple entrances in a similar sense.
Computers have numerous entrances.
Programs can be assigned ports for accessing them.
In our case, we're accessing the app via Port 4200.
Let's learn how to turn off the server.
It's simple switch back to the command line.
We can terminate the server by pressing control, see on our keyboards.
If you're on a Mac, you can press Command C instead.
Great for the rest of this course.
You should always have the server running unless I state otherwise.
We've got everything we need to start writing an app.
In the next lecture, we're going to explore the files generated by the Seelye.