[BETA] koa-gerJs
Use gerJs library plus use the models to validate and reformat the input/ouput payload in the API.
Example : https://github.com/dobobaie/example-koa-gerjs-server
Help us to improve the project by contributing 👥
☁️ Installation
$ npm install gerjs-koa
📝 Usage
Use gerjs-core documentation to create modelsAPI
file.
Initialization
Create a new instance :
Then create the models. Joi
is required.
const modelsAPI = require("./models/models");
const gerJs = require("gerjs-koa")({
exportTo: 'path/doc',
})(modelsAPI);
⚙️ GerJs initialization in Koa side
const Koa = require("koa");
const router = require("koa-router");
const app = new Koa();
app.use(gerJs.middleware(router));
app.use(
router
.get("/swagger", gerJs.expose())
.get("*", ctx => ctx.throw(boom.notFound()))
.routes()
);
👥 Contributing
Please help us to improve the project by contributing :)
❓️ Testing
Clone the repo and run from the project root:
$ npm install
$ npm test