Guinea Pig Facts
An API that allows users to create an account, add a guinea pig fact, and opt in to receive weekly facts.
Table of Contents
Getting Started
Prerequisites
- Java 8: if it not already installed follow these Instructions
- MongoDB
- CLI: follow the Installation Guide
- MongoDB Atlas: create an account and follow the Getting Started Guide
Installing
- Clone repository: git@github.com:KorynLA/GuineaPigFactsBackend.git
- Update the mongoDB that will be used by the application.
- If using MongoDB Atlas:
- cd /\/guineaPigFacts/src/main/resources
- Remove all text from application.properties
- Add spring.data.mongodb.uri=
- If using MongoDB local
- cd /\/guineaPigFacts/src/main/resources
- Update application.properties with database name you want to save the data in line 7: spring.data.mongodb.database=
Local Deployment
- Have mongoDB instance running
- Locally
- Open a new shell and run the command: mongo
- MongoDB Atlas
- Should already be running. The system status can be checked here
- cd /guineapigfacts
- Run ./mvnw spring-boot:run
Endpoints
/user
- /user/{id}
- GET
- Retrieves user with the ID passed in the URL path
- /user/
- POST
- Adds a user to the User collection
- /user/{id}
- PUT
- Updates a document in the User collection with the ID passed in the URL path
- /user/{id}
- DELETE
- Deletes a document with the ID passed in the URL path
/fact
- /fact/
- GET
- Retrieves all facts in the Fact collection
- /fact/{id}
- GET
- Retrieves fact with the ID passed in the URL path
- /fact/
- POST
- Adds a fact to the Fact collection
- /fact/{id}