0
Q:

what is express.js

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
9
basic server

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


app.get('/',(req,res)=>{
   res.json({message: 'Welcome to the backend'})
})


app.listen(PORT ,()=>console.log(`Connected to ${PORT}`)
           
           
10
// Load HTTP module
const http = require("http");

const hostname = "127.0.0.1";
const port = 8000;

// Create HTTP server 
const server = http.createServer((req, res) => {

   // Set the response HTTP header with HTTP status and Content type
   res.writeHead(200, {'Content-Type': 'text/plain'});
   
   // Send the response body "Hello World"
   res.end('Hello World\n');
});

// Prints a log once the server starts listening
server.listen(port, hostname, () => {
   console.log(`Server running at http://${hostname}:${port}/`);
})
4
Express.js, or simply Express, is a web application framework for Node.js,
released as free and open-source software under the MIT License.

It is designed for building web applications and APIs.
It has been called the de facto standard server framework for Node.js.
7
Express is a minimal and flexible Node.js web application framework
that provides a robust set of features for web and mobile
applications.
5
Express is a minimal and flexible Node.js web application framework
that provides a robust set of features for web and mobile
applications.
0

New to Communities?

Join the community