Express Js Is Web Framework For Node.js
- Most Popular Use Of Express Js In the Current Time Is To Create Web Apis.
- Also Some People Are Using To Create Full-stack Web App With using Pug, Ejs, Or Basic HTML
here we are going to create a simple API to understand concepts of express
You need Node.js Installed In Your System. You can download node.js from Node.js
Open New Directory And Write This command to initialize a new project.
npm init -y
-Now install express as dependencies for your project
npm install express
- Create index.js file and import express js & initialize the app
- Create an endpoint
in simple term endpoint is a path where you are getting expected data
/users return all users
/products returns all products
3 Open a port for connections
- Run application
node index.jsto start the application
- open localhost:3000 on browser
now try to render Html. try to create forms & process data using any database.
find material online and create your own express apps.