TypeScript and Ajv generator add-on for nanoexpres available only in ESM mode
This add-on may not work as expected or not work at all
npm i @nanoexpress/addon-swagger-parse
# or
yarn add @nanoexpress/addon-swagger-parse
- YML (preferred)
- JSON
- RAW JS Object
await swaggerParse(fs.readFileSync('docs.yml'));
const dtsInterfaces = await import('dts-interface.d.ts');
const dtsValidations = await import('dts-validations.json');
/// auth/index.js
app.get(
'/auth',
// Here any body-parser, form-data logic (all preprocess middlewares)
schematorInstance.load({
attach: '/auth',
method: 'get',
path: './auth/docs.yml'
}),
async (req) => {
// your logic here
}
);
GPL-3.0