Giter Club home page Giter Club logo

superheroes-api's Introduction

superheroes-api

ABM about Superheroes.

Superheroes are not created by api, but yes by the database (flyway).

run

docker build -t superheroes-app .

docker run -p 8090:8080 superheroes-app

The api will be available on port 8090.

Example:

http://localhost:8090/ping

Response:

pong

Api documentation

After executing the above instructions, you can access the documentation:

http://localhost:8090/swagger-ui/#/

Available tokens

  • As Admin (permissions: VIEW, CREATE, UPDATE, DELETE):

    Token: TEST_ADMIN_ROLE

  • As View (permission: VIEW):

    Token: TEST_VIEW_ROLE

Improvements to be made

  1. Improve the authentication part.
  2. Improve security on the IDs that are used in the URLs.
  3. Improve dockerfile.
  4. Improve test coverage.
  5. Response (return id).

Requests

  • Get all superheroes:

    curl --location --request GET 'localhost:8090/superheroes?size=5&page=0'
    --header 'Token: TEST_VIEW_ROLE'

    curl --location --request GET 'localhost:8090/superheroes?size=5&page=1'
    --header 'Token: TEST_VIEW_ROLE'

  • Get superheroes with the filter for the name:

    curl --location --request GET 'localhost:8090/superheroes?size=5&name=1&page=0'
    --header 'Token: TEST_VIEW_ROLE'

  • Get superheroes by ID:

    curl --location --request GET 'localhost:8090/superheroes/2'
    --header 'Token: TEST_VIEW_ROLE'

  • Put a superhero:

    curl --location --request PUT 'localhost:8090/superheroes/2'
    --header 'Token: TEST_ADMIN_ROLE'
    --header 'Content-Type: application/json'
    --data-raw '{ "name": "new name for superhero 2"
    }'

  • Delete a superhero:

    curl --location --request DELETE 'localhost:8090/superheroes/11'
    --header 'Token: TEST_ADMIN_ROLE'

superheroes-api's People

Contributors

elianadiaz avatar

Watchers

James Cloos 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.