@pfc/http-adapter
v1.0.9
Published
This library aims to encapsulate an http structure for Query Side components in a CQRS based architecture.
Downloads
12
Keywords
Readme
HTTP Adapter
Koa-based library provides the necessary framework for Query Side services to be created.
Requirements
- Typescript
- Koa
- Pino (Logger)
Setup
To install, use the file pro package.json
option in the project:
"dependencies": {
"http-adapter": "file:../../libs/http-adapter",
...
}
How to Use
To use it, you need to create a Mapper of the routes and functions to be executed:
import { HttpAdapter } from "http-adapter";
const MyQueryMapper = {
"/myroute/": MyCallableFunction,
};
HttpAdapter({
QueryMapper: MyQueryMapper,
}).listen(8080);
Note: All routes will be mapped and built using the GET method.