Git Product home page Git Product logo

book's Introduction

#Book REST service.

mvn clean package

Use: http://localhost:8080/books/readers/{reader_id}/books/{book_id}
Methods:

  • GET - book_id not use, list of book for reader

Url `http://localhost:8080/books/readers/1/books` - PUT - add book to reader
Url `http://localhost:8080/books/readers/1/books/2` - DELETE - 'back' book from reader
Url `http://localhost:8080/books/readers/1/books/2`

Bonus: Add book:
Method: PUT
Url: http://localhost:8080/books/books/
Body: {"book":{"title":"title 1", "author":"Author 100"}}


Tasks list:
  1. MyBatis query for get Reader`s by Book, get Book`s by Reader.
  2. Create 3 Book, 2 Reader, 1 Reader read 0 Book, 1 Reader read 2 Book. Test 1 query.
  3. Run tomcat.
  4. Create servlet.
  5. War. In pom file:
    <!--<packaging>jar</packaging>-->
    <packaging>war</packaging>
  6. Test injection mappers into Servlet throught Services.
  7. Parse url.
  8. Dispatch url`s
  9. Controllers. Link url with Controllers throught reflection. Controller interface.
  10. Select JSON lib.
  11. Http methods parse.
  12. End interface, Controllers.
  13. Decorate myBatis mappers, entities.
  14. Entity to JSON decore.
  15. REST pribciples.
  • URL:
    Example: /books/v1.0/books/10
    ../books/search/Title
    Add parsing !!!
  • Params:
    URL - only query, JSON - all data.
  • Methods:
    • GET - list, concrete
      /books/v1.0/books/10
      /books/v1.0/books
      Search: ?title=book1
    • DELETE - удаление
      /books/v1.0/books/10
    • PUT - idempotent - add, update
      ???
    • POST - ???
  • Errors:
    • 200 OK
    • 201 Created (Запись создана)
    • 400 Bad Request (некорректный запрос)
    • 404 Not Found (Данные не найдены)
    • 500 Internal server error (внутренняя ошибка сервера) return text
      error JSON format
  1. Methods:
  • выдать книгу абоненту; readers/{id}/books/{id} put
  • принять книгу у абонента; readers/{id}/books/{id} delete?
  • получить список книг, выданных заданному абоненту readers/{id}/books get

TODO:

  1. Test REST.

  2. End all domain REST.

  3. Rest:

  • Version:
    v1.0
  • Validation?

book's People

Contributors

sergerg avatar

Watchers

 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.