Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create API/README.md #808

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/API/Middlewares/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# API Middlewares

## HttpExceptions

This middleware is responsible for converting exceptions thrown in the API module into HTTP responses.

If there's an error this middleware has no knowledge of, `Internal Server Error` is returned.

No other file in the module should have knowledge about HTTP response statuses.

## Logger

Adds the passed logger to KOA's `context`, making it available to other middlewares.

## RequestValidation

Adds Joi validation to API endpoints.
13 changes: 13 additions & 0 deletions src/API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# API

This module manages the HTTP API of the Po.et Node.

It has a close relationship with the View module: the View module is in charge of listening to different RMQ messages to build the state of the Po.et Node that is exposed to the world and the API module is in charge of actually exposing it to the world.

As such, API is the only module that has direct access to another module's DB: the View's module. This access is read-only.

For write operations (`POST` requests), the API broadcasts a RMQ message signaling the user's intent and immediately returns an ACK.

## Middlewares

See [/middlewares](./Middlewares).