NODE: Express Basics
Learn Express Basics in NODE with practical examples.
NODE — Express Basics
Overview
Express is a popular Node.js web framework for routes and middleware.
What you'll learn
- Create app
- Routes
- req/res
- Start server
Syntax
app.get("/", (req,res)=>res.send("Hi"));
Example
import express from "express";
const app = express();
app.get("/", (req,res)=>{
res.send("Hello DrSchool");
});
app.listen(20010, ()=>console.log("http://localhost:20010"));
Notes
- Use app.use for middleware.
- Use environment variables for PORT.