Git Product home page Git Product logo

demo-city's Introduction

Nothing fancy here, just an example Spring Boot app, to brush up

Requisites

  • Java 8+
  • Apache Maven 3.6+
  • Postman 6.7+ (Optional)

Install

In order to start the application run command below in root dir

./mvnw spring-boot:run

Usage!

When you run this app you can access its features using several RESTful endpoints. This app exposes HATEOAS endpoints.

Endpoints
Usage & Examples

This app apply pagination and sorting. You can use size, page, sort parameters to get custom pagiantion and sorting. Default page size is 20. Under the "page" attribute you can find information about the page, and under "_links" attribute you can find links for the next/previous pages etc..

Get status of app

Architecture

This app uses Spring Data REST. Spring Data REST is part of the umbrella Spring Data project and makes it easy to build hypermedia-driven REST web services on top of Spring Data repositories. Spring Data REST builds on top of Spring Data repositories, analyzes your application’s domain model and exposes hypermedia-driven HTTP resources for aggregates contained in the model. At runtime, Spring Data REST automatically creates an implementation of CityRepository. Then it uses the @RepositoryRestResource, and @RestResource annotations to direct Spring MVC to create RESTful endpoints. CityRepository also extends from PagingAndSortingRepository which is extension of CrudRepository(Interface for generic CRUD operations on a repository for a specific type) to provide additional methods to retrieve entities using the pagination and sorting abstraction. more

Flyway is the choise of migration tool. Flyway strongly favors simplicity and convention over configuration. DB scripts located under /resources/db/migration/ .

H2 Database is used in test and runtime.

Tests

Sprign Data REST entities are cumbersome to Mock/Spy, hence to test. On the other side considering with Spring Data REST there is not much coding done, which makes unit test less favorable. Considering that Integration test with preloaded DB implemented in this app. I opted start server to run test but there is another useful approach which is to not start the server at all but to test only the layer below that. more

More

You can use cities.posman_collection.json for example queries if you have postman installed. Also the file is human readable without postman app.

City database added from https://simplemaps.com/data/world-cities

demo-city's People

Contributors

mammadjafar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.