8/26/2018 - 12:13 AM

Basic Node Web Server

Make sure you install nodejs from their website and also a terminal(preferabbly git bash).

First, create a new npm project by doing "npm init"

Now, just fill out the information for your app.

Now, actually install express itself. "npm install express --save"

This adds it to your dependencies list so you can automatically install it if you move your project to another machine.

Now, you can go ahead and create the app itself. Look in the code below to see how I did that. Make sure all of the code goes into a file named app.js

The app.listen method call is just telling the application to listen on port 3000, meaning that the website/web application can only be run on that port. For example, if I run localhost:3000, that will work as compared to localhost by itself, or even localhost:5000. The website will only work on 3000. 

To actually run the application, go into your terminal and run "node app.js"

If you have any questions or edits I can add to this, leave a comment here or on my video. 
const express = require('express');
const app = express();

app.listen(3000, () => console.log('Example app listening on port 3000!'));