0.0.1-rc.0 • Published 2 years ago
@docex/middleware v0.0.1-rc.0
⚙️ Installation
npm install --save @docex/middleware
💻 Usage
const http = require('http');
const Koa = require('koa');
const Router = require('koa-router');
const docex = require('docex').default;
const app = new Koa();
const router = new Router();
router.get('/', (ctx, next) => {
const obj = {
name: 'Docex',
version: '0.0.1'
};
ctx.body = obj;
return obj;
});
app.use(docex({
openapiPath: './openapi.yaml',
savePath: './docs'
}));
app.use(router.routes());
app.use(router.allowedMethods());
module.exports = http.createServer(app.callback()).listen(3000);
openapi: 3.0.0
info:
# ...
paths:
/:
get:
summary: Simple endpoint
responses:
'200':
description: Test
content:
application/json:
schema:
$ref: '#/components/schemas/Test'
components:
schemas:
Test:
type: object
properties:
name:
title: 'Name'
version:
title: 'Version'
0.0.1-rc.1
2 years ago
0.0.1-rc.0
2 years ago