We’re going to design an API using Node.js and MongoDB for the doctors of a Hospital which has been allocated by the govt for testing and quarantine + well being of COVID-19 patients
- Clone the Package to your local System
- Navigate to the folder wherein the project has been cloned
- Open Terminal and type
npm install
[Make sure node is already installed in your system!] - Type
node app.js
- The app should run on default port 8000 or if you've mentioned env port it'll run on that.
- Not working? Ping me!.
1)/doctors/register
→ Registers a new Doctor to the hospital Database takes in madatory username
and password
2) /doctors/login
→ Doctor Login with username and password, if Authenticated, Returns the JSON Web token, takes in madatory username
and password
3) /patients/register
→ API to register a new Patient, This is a protected route only authorized doctor can create a new Patient. Takes in madatory patients id, whichis the phone number as phone
4) /patients/:id/create_report
→ API to create a report for the Patient with ID id
. Takes in a mandatory field Status
in it
5) /patients/:id/all_reports
→ To Show all the reports of a particular Patient with id id
. unprotected Route.
6) /reports/:status
→ To Show all the reports in the database with a particular status
lets say Positive or Negative Or Quarantined etc.
- Entry point : app.js.
config
: Contains configuration files of Mongoose and Passport Authentication Strategies.Controllers\api
: The controllers for various API's like Doctor API or Patient API or Report API.Models
: Mongoose Models for the Doctors, Patients and reports!routes
: index.js which manages routes efficiently to have a scalable project.views
: Empty For now :)