stonytv / node-express-course Goto Github PK
View Code? Open in Web Editor NEWAn introduction to Node.js and Express.js servers
Home Page: https://lab.github.com/everydeveloper/introduction-to-node-with-express
An introduction to Node.js and Express.js servers
Home Page: https://lab.github.com/everydeveloper/introduction-to-node-with-express
Traditionally, JavaScript is a browser-side programming language. However, Node.js gives you the ability to run JavaScript files on the server-side. Express is a library for Node.js, that allows you to make requests to different "endpoints" and get a response back.
In this tutorial you will learn how to:
When you see the ๐ก symbol, the following info is a optional tip, or context.
This tutorial is interactive. Look for instructions on how to complete each step at the bottom of the issue. If the next step doesn't appear, try refreshing the page.
When you are ready to start, close this issue.
First, let's install Node.js, and an app called Postman to test our API. You will be coding along with me, so make sure you also have git installed.
Node.js comes with something called NPM (Node Package Manager) that we will use manage our node modules. You can check if you have Node, NPM, and Git installed by running these commands (one at a time):
node -v
npm -v
git --version
You should get a version back from each of these commands. If you get an error, you'll want to check that it was correctly installed.
By signing up for this course, a template repository was created on your GitHub account. Clone this repository locally on your computer and navigate to it by running:
git clone https://github.com/jdathueyt/node-express-course.git
cd node-express-server-intro
Open the folder you just cloned in your favorite text editor.
You should have a few files already created:
.gitignore
server.js
The server file will be the main one we use. In the .gitignore folder, you should see this line at the top /node_modules
Express (the server library we will install) is a node_module. Rather than track the entire library in our git history, we will create a package.json file, which will allow us to install and save node modules.
Run this from your command line: npm init -y
You should have a package.json file in your folder now.
Now you can install Express using NPM. Enter this command in the terminal: npm install express --save
A folder called node_modules should apear in your project. This is where the actual files for express are stored. If you open the folder, you can see how many files there are. These will only be stored on your machine, because we told git to ignore this entire directory.
In your package.json file and make sure you have something like this under your dependencies:
"dependencies": {
"express": "^4.17.1",
}
The number on the right is the version you downloaded. Since we aren't tracking the actual node_modules
folder, this section is a reference used to re-install the modules your application depends on.
When you are finished with this section, push your file to GitHub for the next step:
git add .
git commit -m "initial file setup"
git push origin master
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.