Coder Social home page Coder Social logo

kendyjm / restful-web-services Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 2.63 MB

Master Microservices with Spring Boot and Spring Cloud : Part 1 - Restful Web Services with Spring Boot

Home Page: https://www.udemy.com/course/microservices-with-spring-boot-and-spring-cloud

Java 99.24% PLSQL 0.76%
spring-boot restful-api hateoas-hal internationalization actuator-spring-boot jpa spring-security spring-boot-2

restful-web-services's Introduction

Master Microservices with Spring Boot and Spring Cloud : Part 1 - Restful Web Services with Spring Boot

Context

Instructor:

Udemy Certificate of completion

https://www.udemy.com/certificate/UC-ed0e4498-34b0-485f-bce4-54782fc08206/

Content

  • What is a RESTful Web Service?
  • How to implement RESTful Web Services with Spring and Spring Boot?
  • What are the best practices in designing RESTful Web Services?
  • How to design Resources and GET, POST and DELETE operations?
  • How to implement Validation for RESTful Web Services?
  • How to implement Exception Handling for RESTful Web Services?
  • What is HATEOAS? How to implement HATEOAS for a Resource?
  • What are the different approach in versioning RESTful Services?
  • How to use Postman to execute RESTful Service Requests?
  • How to implement basic authentication with Spring Security?
  • How to implement filtering for RESTful Services?
  • How to monitor RESTful Services with Spring Boot Actuator?
  • How to document RESTful Web Services with Swagger?
  • How to connect RESTful Services to a backend with JPA?

Keywords

  • Service Definition :
    • OData (standard for REST Service Definition), pas très utilisé, à voir si curieux...sinon en rester aux formats alternatifs (mais non standards) : WADL (pas populaire), et surtout Swagger.
    • Swagger : just put one dependency (springfox-swagger2) and a @Configuration (see SwaggerConfig class in this project) to get doc in json via endpoint /v2/api-docs , and another one (springfox-swagger-ui) to get Swagger UI via /swagger-ui.html
  • Exception handling : ResponseEntityExceptionHandler, @ControllerAdvice, ResponseEntity
  • Validations : @Valid, javax.validation.constraints.* (@Size, @Past etc)
  • HATEOAS : Hypermedia as the Engine of Application State; With HATEOAS, a client interacts with a network application whose application servers provide information dynamically through hypermedia
  • Internationalization : LocaleContextHolder, AcceptHeaderLocaleResolver
  • Content Negociation : just add jackson-dataformat-xml to support response in xml (just an example)
  • Monitoring : actuator, hal browser, management.endpoints.web.exposure.include
  • Static Filtering : simply put an @JsonIgnore on each field to filter
  • Dynamic Filtering : wrap the POJO into a MappingJacksonValue and pass it in to the RestTemplate (the biggest issue for me is the hardcoded fields name); SimpleBeanPropertyFilter, SimpleFilterProvider, @JsonFilter in the POJO.
  • Versioning : 2 main strategies: URI/REQUESTPARAM versioning or CUSTOMHEADER/MEDIATYPE versioning, the first one is maybe the best
    • STARTING BUILDING OF AN API: CHOOSE YOUR VERSIONING STRATEGY !
  • Security / Basic Authentification : just add spring-boot-starter-securityas a dependency
  • REST best practices : See Octo Technology Reference Card, a MUST READ!!
    • Richardson Maturity Model
    • Le client doit comprendre les WS
      • avoir une documentation suffisante et compréhensible
    • Utiliser au mieux les possibilités offertes par HTTP
      • Notamment en utilisant ses méthodes (GET, PUT, POST, DELETE) de façon appropriée
      • Renvoyer le satut de réponse le plus approprié (pas juste un 200, mais un 201 par exemple lors d'une création)
        • 200 - success
        • 404 - resource not found
        • 400 - bad request
        • 201 - created
        • 401 - unauthorized
        • 500 - server error
      • Pas d'informations sensibles dans les URI
      • Préférer le PLURIEL au SINGULIER
        • Préférer /users à /user
        • Préférer /users/1 to /user/1
      • Préférer des NOMS plutôt que des VERBES pour les resources
        • Préférer DELETE /users/1 plutôt que DELETE /deleteUser/1
        • PUT /posts/{id}/star // pour ajouter une étoile à un post
        • DELETE /posts/{id}/star // pour supprimer une étoile à un post

Startup

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

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.