Back to Courses

World's Best MERN Stack Course

MERN Tutorial #3: Getting Started with Backend | Creating a Server using Express.JS

Welcome, In this tutorial will take you through Express.js step by step. First, we'll explain the folder structure, so you know how to organize your project. You'll learn how to install packages and configure package.json files. Next, we'll show you how to install Express.js, one of the most popular Node.js frameworks. We'll then walk you through how to set up your main server.js file. You'll be well on your way to creating your own server using Express.js after watching this video. Let's get started!

const express = require("express");
const app = express();

app.get("/", (req, res) => {
  res.status(200).send("Welcome to thapa technical Mern Series Updated");
});

app.get("/register", (req, res) => {
  res.status(200).json({ msg: "registration successful" });
});

const PORT = 5000;
app.listen(PORT, () => {
  console.log(`server is running at port: ${PORT}`);
});