What Is Express Js?
Express Js Is Web Framework For Node.js
Where To Use Express 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
Getting Started
Requirements
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 basic hello world API
- 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
here we have created endpoint /
where we are sending hello world as a response.
3 Open a port for connections
- Run application
> write
node index.js
to start the application
- open localhost:3000 on browser
hooray you made it 🥳
what now
now try to render Html. try to create forms & process data using any database.
find material online and create your own express apps.
Top comments (0)