Skip to content

This repo can be used as a Template for Rest API using spring-boot-microservices and MongoDB as Database.

License

Notifications You must be signed in to change notification settings

ravening/SpringBootRestAPI

 
 

Repository files navigation

License: MIT Travis Build Status sonar codecov Build status

contributions welcome Open Source Love PRs Welcome first-timers-only-friendly HitCount

Desciption

This project mainly focussed on the Kickstart to the CI/CD using TravisCI. Includes CodeCoverage, Sonarqube integration which can be plugged into any application.

Task List Progress

  • Rest controllers and models using SpringBoot
  • MongoDB configuration
  • TravisCI build
  • SonarQube integration
  • Jacoco Test report
  • JWT authentication
  • 80% and above Code Coverage (using codecov or coveralls)
  • Cloud deployment

Getting Started

  • Import this project into your favourite IDE after fork and checkout of this repository.

Pre-requisite and Installing Steps

  • Get a running instance of MongoDB that you can connect to. For more information on getting started with MongoDB, visit their online tutorial.

  • Start by creating a test database. I will call mine "rest_tutorial" using the following command in the MongoDB shell, or through a database manager like MongoDB Compass: use rest_tutorial;

  • Create a sample collection that will hold data about different types of pets. Let's create the collection with the following command: db.createCollection("pets");

  • Once the collection is created, we need to add some data! We can add data to the collection with the below query, you can add any number of data like this : db.pets.insertMany([ { "name" : "Spot", "species" : "dog", "breed" : "pitbull" }, { "name" : "Daisy", "species" : "cat", "breed" : "calico" }, { "name" : "Bella", "species" : "dog", "breed" : "australian shepard" } ]);

  • Add the mongodb authentication-database, username & password in application.properties If there is no authrntication when you are running locally then you can also remove these properties from this file.

Running the tests

Once the server starts, you are free to test your API however you choose. Use postman for the below tests :

Code Coverage

For code coverage reports integration, I have shown example using Codecov and Coveralls as both are pretty popular and easy to integrate with the travis.

Issue Request Template

Are you up for your first Issue Request for this project !!! Awesome but please first go through the ISSUE TEMPLATE.md and use this template to submit any issue request.

Pull Request Template

Are you up for your first PR for this project !!! Awesome but please first go through the PULL REQUEST TEMPLATE.md and use this template to submit your PR.

Contributing

Please read CONTRIBUTING.md and CODE OF CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Gourav Rusiya

About

This repo can be used as a Template for Rest API using spring-boot-microservices and MongoDB as Database.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.1%
  • Shell 2.9%