3. Running the server and viewing the project

With the starter code downloaded and dependencies installed, now's the time to open the code in your IDE or text editor. This one I'm using is PhpStorm, but you can use whatever you like.

Looking at the completed version of the app we're about to build, you can see that we're able to perform search queries that return a response.

The point is, we have a Node.js backend that handles those queries, along with the file serving.

You'll see in the starter code we have a script for this server.

If you're not familiar with Node.js it's no problem, because I've already made the server, you just have to run it.

To do that, open up your terminal again and make sure you're in the project directory. Then type...

$ npm run serve

Once you press enter you should then see a message printed in the terminal saying the app is listening on port 3000, which means it's working.

If you ever need to stop the server, you can just press Ctrl + C in the terminal and that will kill it. You can then restart it again by typing npm run serve again.

Open in browser

Once your Node server is running, you can view the project in your browser.

I'm going to be using Firefox for this course, because not only is it a great browser, but I also like the fact that Firefox is trying to keep the web open and free, unlike some other browser companies who don't need mention.

You can use whatever modern browser you want, though.

To view the project, open a tab and type http://localhost:3000 into the URL bar. That's the address that the Node server is listening to.

You should now see this page, which is the basic structure of our project. Obviously, we're going to be filling in the rest of the page as we progress though the course.

Complete and Continue  
Discussion

0 comments