Simple Rest API that displays a way of constructing and designing a simple Spring boot REST API using MongoDB. We are going to use Mlab to host the db instance.
- Java 8
- Spring boot
- MongoDb
- Mlab
- If you don't have an Mlab account, you should create one... it's free.
- Create a new DB deployment. Select your favorite cloud provider and the Plan type of your preference (Sandbox is free).
- Select the Region that's more suitable for you.
- Name your db.
- Click into your newly created db instance. Go to the Users tab and add a new user to your db.
- Make sure that has write and read privileges (ReadOnly = false).
- Now that you have the user, you should be able to connect to your db instance through Mongo shell or via the standard MongoDB URI. In our case, we'll be using the MongoDB URI.
- Clone this repo
git clone blablabla
- Create env variables to store your MongoDB username, pasword and db name.
- Controller
- Service
- Model - Document 👀
- DTO pattern implementation.
- REST tests and unit tests
Made with love by ❤️ gorygon - jdgonzaleza😀