node js with express framework code example
Example 1: node js express
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}`)
Example 2: what is express.js
Express is a minimal and flexible Node.js web application framework
that provides a robust set of features for web and mobile
applications.