This project is a server designed for the management of emergency supplies, utilizing MongoDB for data storage. It supports operations such as saving, viewing, updating, and creating records of emergency supplies. The API is accessible through a Postman collection, enabling straightforward interaction with the server for various CRUD operations.
- Node.js
- MongoDB
- Postman (for API testing)
- Clone the repository to your local machine.
- Install dependencies by running
npm installin the project directory. - Ensure MongoDB is running on your system.
- Create a
.envfile in the root directory and configure the following environment variables:MONGO_HOSTMONGO_USERNAMEMONGO_PASSWORDMONGO_CLUSTERMONGO_DBNAMEPORT
- Start the server with
node index.js.
Ensure the .env file contains the following variables for MongoDB connection:
MONGO_HOST=
MONGO_USERNAME=
MONGO_PASSWORD=
MONGO_CLUSTER=
MONGO_DBNAME=
The server provides the following endpoints for managing emergency supplies. The notation /:param indicates that a parameter is expected in the URL path, not as a query string.
GET /supplies: Retrieve all emergency supplies.GET /supplies/:name: Get a single emergency supply by name.POST /supplies: Add a new emergency supply record.PUT /supplies/:name: Update an existing emergency supply record by name.DELETE /supplies/:name: Delete an emergency supply record by name.
For detailed usage and examples, refer to the Postman collection.