You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The required libraries needed for Express, MongoDb, and Swagger
Initializing express and using .env file for setting the port and mongodb url
Setting up swagger for "/api-docs" endpoint
Connecting to mongodb and using the PORT from env
GET endpoints
"/" returns a welcome message
"/users" returns all users with 200 response or 500 response if there is server error
"/users/:id/" returns one user based on id with 200 response, 404 if user cannot be found, or 500 if there is a server error
POST endpoint
"/users" creates a new user with 201 response, 400 if the body fails validation, or 500 if there is server error
PUT endpoint
"/users/:id" updates an existing user with 200 response, 404 if user cannot be found, 400 if the body fails validation, or 500 if there is a server error
DELETE endpoint
"/users/:id" deletes an existing user with 200 response, 404 if user cannot be found, or 500 if there is a server error
The response from wizard-world-api is validated to ensure it has all of the required fields in the HarryPotterHouseSchema before being saved to HarryPotterHouse collection in MongoDB