Table of Contents
๐ We will be building a simple Express Server application for learning how "servers" and "clients" communicate using Node.js and Express!
Node.js is a software created to make server-side programming with JavaScript possible. This allows developers to use the same language for both the frontend (what you see in your browser) and the backend (the server handling data and logic). This consistency can make development more efficient and streamline the process of building a web application.
Express is a web application framework for Node.js. It allows you to quickly create routes and APIs and handle requests and responses. With middleware and a minimalist structure, Express.js makes it easy to build fast and scalable web apps and services using Node.js.
-
Create Repo from Use Template:
- Click HERE or the
Use Template
button in this repo to create a new repo. - Ensure
Include all branches
is left unchecked. - Specify your username and repo name appropriately.
- Provide a description for the repo (optional).
- Set the repo as
Public
. - Click
Create repository
.
- Click HERE or the
-
Clone your Repo:
- Click the
<> Code
button in this repo and chooseSSH
. - Copy the URL. It should look something like:
[email protected]:YOUR-USERNAME/YOUR-REPO-NAME.git
. - In your terminal, navigate to the directory where you want to clone this repo.
- Execute
git clone [email protected]:YOUR-USERNAME/YOUR-REPO-NAME.git
, replacing the placeholders with actual values.
- Click the
-
Initialize Node.js application in Repo:
-
In the terminal, navigate to the folder you cloned this repo to and run the following to create a default
package.json
file:npm init -y
NOTE: Project names (when running
npm init
without the--y
) can not have capital letters or spaces. -
-
Install Express package:
-
In the terminal, we need to install Express to use it:
npm install express
-
You will be adding code to the server.js
and the client.js
files in your code to get your server and client both running.
NOTE: The key combination
ctrl-c
will stop your server/client from running once you have it created and started. Whichever current Node.js process is running in that terminal will stop on macOS.
Follow along with your instructor to create a splendid Express Server application! Happy Priming!