Code Skiller logoCB Logo
Logo LearnLearnLogo PracticePracticeLogo HireHireLogo IDEIDE

Introduction to Express JS

User image

Published by

sanya sanya

Published at: 28th Jul, 2023
2.095 mins read

The ExpressJS is a popular and lightweight web application framework for Node.js. The ExpressJS provides a flexible way to build web applications and APIs in an easy and simple manner.

ExpressJS follows the Model-View-Controller (MVC) architectural pattern, although it's more minimalistic and unopinionated compared to full-fledged MVC frameworks.

ExpressJS offers a wide range of features and functionalities that make it a preferred choice for developers. Some of its key features include the following below -

  • Routing
  • Middleware
  • Templating
  • Error Handling
  • Database Integration
  • Extension through Middleware

Difference between Library and Framework

The difference between the Library and Framework are mentioned in the table below -

LibraryFramework
The Library can be integrated anyplace, anytime in the project.Have fixed set of integration in framwork to be used in a project.
A framework is a more comprehensive and structured set of tools and guidelines that dictate the overall architecture and flow of a software application. A framework is a more comprehensive and structured set of tools and guidelines that dictate the overall architecture and flow of a software application.
Its provide more flexibility.Its provide less Flexibility.
const axios = require('axios'); const express = require('express');

Ports

In ExpressJS, ports refer to the numeric identifiers used to establish network connections between the server and clients.

Ports enable communication between different applications or services over the Internet using the TCP/IP protocol.

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


const port = 3000;
app.listen(port, () => { console.log("Server"); });

Everytime when making a change, we have to restart the server to observe the changes by the code mentioned below -

node index.js

What is Port 3000

Port 3000 is a commonly used port number for web applications and development servers. In the context of web development, Port 3000 is often used as the default port for running web servers locally during the development and testing phase of web applications.

When you run a web server on your local machine, it needs to listen on a specific port to handle incoming HTTP requests. Port 3000 is frequently chosen because it is not a reserved port, meaning it is not associated with any specific service by default. This makes it convenient for developers to use without conflicting with other services that might be running on standard ports.

Library

WEB DEVELOPMENT

Basic

Frontend

Express JS

Introduction to Backend

Node Package Manager

Introduction to Express JS

More in Express JS

Path Query

React

Backend

Interview Questions

FAANG QUESTIONS

On this page

Difference between Library and Framework

Ports

What is Port 3000