💫 CRUD on Hospital data JSON file using Core modules from Node JS and Express
The requirement is as follows 📝
- Set up Hospital Data in JSON file with following information: Name of the hospital, Patient Count and Hospital location
- Perform CRUD(GET,POST,PUT,DELETE) operations on the dataset
- Use the core modules available in NodeJS to read,write to the JSON file.
GET request - Read list of all hospitals
➡️ GET http://localhost:3000/api/hospitals
GET request - Read a single hospital
➡️ GET http://localhost:3000/api/hospitals/:id
POSTMAN result:
POST request - Create a new Hospital
➡️ POST http://localhost:3000/api/hospitals
POSTMAN result:
PUT request - Update an existing Hospital
➡️ PUT http://localhost:3000/api/hospitals/:id
POSTMAN result:
Before PUT request is sent
After PUT request is sent
DELETE request - Delete an existing hospital
➡️ DELETE http://localhost:3000/api/hospitals/:id
POSTMAN result:
Before DELETE request is sent
After DELETE request is sent