Skip to content

codesthq/city-list-app-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

city-list-app (server)

Client startup

https://github.com/sawicki-rafal/city-list-app-client

Server startup

Open a command line (or terminal) and navigate to the folder where you have the project files. One can build and run the application by issuing the following command:

MacOS/Linux

./mvnw spring-boot:run

Windows

mvnw spring-boot:run

Users

There are two users in app:

username password roles
reader reader ROLE_ALLOW_READ
editor editor ROLE_ALLOW_READ, ROLE_ALLOW_EDIT

Authorization is done using basic authentication.

REST API

Server on default runs on http://localhost:8081/. Therefore, API is available on http://localhost:8081/api. Available endpoints:

  • /cities
    • description: Get list of cities in pagable format.
    • method: GET
    • params:
      • page - the offset to be taken according to the underlying page and size.
      • size - the number of items to be returned.
    • example request:
    • example response:
{
    "content": [
        {
            "id": 1,
            "name": "Tokyo",
            "photoUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Skyscrapers_of_Shinjuku_2009_January.jpg/500px-Skyscrapers_of_Shinjuku_2009_January.jpg"
        },
        {
            "id": 2,
            "name": "Jakarta",
            "photoUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Jakarta_Pictures-1.jpg/327px-Jakarta_Pictures-1.jpg"
        }
    ],
        "pageable": {
        "sort": {
            "empty": true,
                "sorted": false,
                "unsorted": true
        },
        "offset": 0,
            "pageSize": 2,
            "pageNumber": 0,
            "unpaged": false,
            "paged": true
    },
    "last": false,
        "totalElements": 1000,
        "totalPages": 500,
        "size": 2,
        "number": 0,
        "sort": {
        "empty": true,
            "sorted": false,
            "unsorted": true
    },
    "first": true,
        "numberOfElements": 2,
        "empty": false
}
  • /cities/{name}

  • /cities/{id}

    • description: Edit city.
    • id - id of the requested city
    • method: PUT
    • body: DTO in JSON format, ex.
{
    "name": "put new name here", 
    "photoUrl": "put new photo url here"
}
    • response: DTO in JSON format, ex.
{
    "id": 32,
        "name": "London",
        "photoUrl": "https://new.url.com"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages