DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

NODE: Express Basics

Learn Express Basics in NODE with practical examples.

Read time: 1 min Words: 37
My Progress

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.