Create Own API Server -
Steps :
1) Check system has Node Js/ npm
Open Command Prompt and Check Node / Npm Installed or not!
If System has no Node/npm
Download Nodejs from - https://nodejs.org/en/download/
In Command prompt, Repeat Step 1 to check if node installed properly.
2) Install Json server
Use this command to install JSON Server
npm install -g json-server
Start JSON Server
json-server --watch db.json
3)You will see This Successful message
\{^_^}/ hi!
Loading db.json
Oops, db.json doesn't seem to exist
Creating db.json with some default data
Done
Resources
http://localhost:3000/posts
http://localhost:3000/comments
http://localhost:3000/profile
Home
http://localhost:3000
4) It will create a server with localhost/portnumber
5) Go to file explorer where db.json file -> open with Notepad/Any
6) Start create API
7) Changes make in db.json file it will reflect on Browser and Command prompt
8) In Postman, we can use same API and perform CRUD operation.
No comments:
Post a Comment
Please let me know if you have any doubts.