Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Express is a popular node framework for creating server applications. In this video, we'll use a command line tool to help generate the basic structure for an Express application. First, let's install the command line tool. Now you may have already done this earlier in the course by using npm install -g express. Doing this automatically installs the very latest version of Express. Now Express may have been significantly updated since the recording of this video, but the version I'm using will still be available.
To use the version I'm using, type npm install - g express at 3.4.x. This will install the latest patched version of Express 3.4. Of course if you're not an administrator on the computer or you don't otherwise have permission to write to the global node modules folder, start your command with sudo. So I'm going to do that now. I'm going to hit the Up button on my keyboard. I'm going to go to the beginning of the line, and I'm going to add sudo here because I do not have permission to write to that folder.
It's going to ask me for my password, and now it installs that version of Express. So now that Express is installed, let's use it. I'm going to change directory to the desktop. I'm going to type CD space and then capital D for Desktop and then I'm going to hit Return. Now I'm going to use the express command line tool. Type in express. And then Space. And now I'm going to type in airline. And what this is going to do is it's going to create a folder named airline, and it's going to put all the code for the project in there.
So now, let's change directory into airline, and install all the dependencies. We can do this all in one line. So I'm just going to copy those commands and Paste, and then hit Return. So now that it's installed all those dependencies, I'm going to type node space app. And that's going to start the application and saying that the server is now listening on port 3000. So let's go to the web browser and load up local host at port 3000. So now we get a welcome screen to Express. At the moment the sample application generated by the Express command line tool is pretty minimal, but it has everything that you need.
It even has a couple of sample routes to help get you started. However, we're going to be building our own application with our own assets. So there's a little bit of cleanup we'll need to do before we get started. So let's start doing that cleanup now. Take the Airline folder and open it in Sublime Text or any other text editor. Let's open up app.js. First, there's a user object that's being created when we require route slash user. We're not going to be using this object. Its a sample that was included by the Express command line tool.
We're going to be adding our own assets later, so for the moment, let's clean out this folder. Now the Express application skeleton is cleaned out and ready to go. In the next video, we'll start building out the application, using the module we built earlier.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101634 Viewers
61 Video lessons · 88389 Viewers
71 Video lessons · 72227 Viewers
56 Video lessons · 103975 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.