Skip to content

Workshop #3: Enhancing API layer

Marcin Zielonka edited this page Nov 22, 2022 · 24 revisions

About 📝

Workshop #3 is about enhancing the API layer - not only the REST one but the API contract in general (e.g. between modules communicating with each other). Therefore, you can find topics such as:

  • HTTP basics (methods, status codes, etc.)
  • REST API conventions
  • Swagger definitions
  • Java components visibility
  • SOLID

This workshop

Source code 🗃

You can find the source code that represents the status of the project after this workshop - TBD


HTTP basics

HTTP methods

HTTP status codes

HTTP request structure

HTTP response structure


REST API

What is REST API

How to build good REST API

Use HTTP methods to describe an action

Endpoint to describe a resource

Use kebab-case for endpoint naming

Return proper status codes

Query params for filtering

Support pagination

Versioning

Standardized error responses


Swagger

What is Swagger

What is OpenAPI


Building efficient REST API layer with Spring Boot

Use DTOs for both request body and responses

Delegate all business logic to the service layer

Handle errors

Apply Swagger


Building scalable domain-driven application

Group code by domain

Apply proper component visibility

One responsibility per component

Clone this wiki locally