Giter Club home page Giter Club logo

springboot-pagination-and-sorting's Introduction

Spring Boot Pagination and Sorting

Gradle based spring boot application which provide APIs with pagination and sorting using test driven development.

I have clearly explained about these topics on Medium.

APIs of the Application

- Read Avengers
- Read Avengers with Pagination
- Read Avengers with Sorting
- Read Avengers with Pagination and Sorting

Get Avengers

  • Request
GET /avengers
Host: localhost:3000
  • Response
Status code: 200 OK
Body:
[
    {
        "id": 1,
        "name": "Iron Man",
        "introducedInMovie": "Iron Man",
        "introducedInYear": 2008
    },
    {
        "id": 2,
        "name": "Thanos",
        "introducedInMovie": "The Avengers",
        "introducedInYear": 2012
    },
    {
        "id": 3,
        "name": "Thor",
        "introducedInMovie": "Thor",
        "introducedInYear": 2011
    }
]

Get Avengers with Pagination

  • Request
GET /avengers-with-pagination?pageNumber=1&pageSize=3
Host: localhost:3000
  • Response
Status code: 200 OK
Body:
[
    {
        "id": 4,
        "name": "Thor",
        "introducedInMovie": "Thor",
        "introducedInYear": 2011
    },
    {
        "id": 5,
        "name": "Loki",
        "introducedInMovie": "Thor",
        "introducedInYear": 2011
    },
    {
        "id": 6,
        "name": "Hulk",
        "introducedInMovie": "The Incredible Hulk",
        "introducedInYear": 2008
    }
]

Get Avengers with Sorting

  • Request
GET /avengers-with-sorting?sort=introducedInYear,desc
Host: localhost:3000
  • Response
Status code: 200 OK
Body:
[
    {
        "id": 7,
        "name": "Captain Marvel",
        "introducedInMovie": "Captain Marvel",
        "introducedInYear": 2019
    },
    {
        "id": 12,
        "name": "Doctor Strange",
        "introducedInMovie": "Doctor Strange",
        "introducedInYear": 2016
    },
    {
        "id": 8,
        "name": "Spider Man",
        "introducedInMovie": "Captain America: Civil War",
        "introducedInYear": 2016
    }
]

Get Avengers with Pagination ans Sorting

  • Request
GET /avengers-with-pagination-and-sorting?pageNumber=0&pageSize=3&sort=id,desc
Host: localhost:3000
  • Response
Status code: 200 OK
Body:
[
    {
        "id": 21,
        "name": "Red Skull",
        "introducedInMovie": "Captain America: The First Avenger",
        "introducedInYear": 2011
    },
    {
        "id": 20,
        "name": "Ultron",
        "introducedInMovie": "Avengers: Age of Ultron",
        "introducedInYear": 2015
    },
    {
        "id": 19,
        "name": "Winter Soldier",
        "introducedInMovie": "Captain America: The Winter Soldier",
        "introducedInYear": 2014
    }
]

springboot-pagination-and-sorting's People

Contributors

shaikrasheed99 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

nigamrishabh

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.