Nearby lessons

3 of 14

🚀 Getting Started with Express JS

📌 What is Express?

Let's build your first Express application!

After setting up the environment, it's time to create your first Express app. Express allows developers to build web servers and APIs quickly and efficiently using simple, readable code.

🧱 Step 1: Create a New File

Create a new file named index.js inside your Express project folder.

Then, type the following code:

Express.js Server
NODE RUNTIME
var express = require('express');
var app = express();

app.get('/', (req, res) => {
    res.send("Hello Codings Points!!");
});

app.listen(8080);
Browser Output
Server logs

⚙️ Core Express Functions Explained

  • var app = express(); — Initializes a new Express application. Think of express() as a class and app as its object.
  • app.get(route, callback) — Defines a route that listens for GET requests at the specified path.
  • res.send() — Sends a response (string, object, or HTML) to the client.
  • app.listen(port) — Starts the server on the specified port and keeps listening for incoming requests.

🧠 Test Your Knowledge

5 Questions

Progress: 0 / 5
Keep Going!Express.js Routing