autodesk-forks-swagger-node-runner
v0.9.0
Published
Forked Swagger loader and middleware utilities
Downloads
233
Maintainers
Readme
autodesk-forks-swagger-node-runner
This package is a fork of apigee-127/swagger-node-runner. The purpose of this fork is to update dependencies and continue to maintain the original package.
Would you like to contribute? Read our contribution guidelines.
:book: Resources
Getting started
You can install this fork via npm:
npm i autodesk-forks-swagger-node-runner
Sample usage with express server:
const SwaggerRunner = require("swagger-node-runner");
const request = require("supertest");
const express = require('express')();
const axios = require('axios');
SwaggerRunner.create({
appRoot: './test/assets/project'
}, async (err, runner) => {
if (err) console.error(err);
runner.expressMiddleware().register(express);
const {statusCode: goodRequest} = await request(express)
.put('/expect_integer')
.query({
name: 123123,
});
console.log(goodRequest); // will output 200
const {statusCode: badRequest} = await request(express)
.put('/expect_integer')
.query({
name: 'string',
});
console.log(badRequest); // will output 400
})