Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

sbor767/swagger-express-middleware-for-multer-1.x

 
 

Repository files navigation

Swagger Express Middleware using the latest version of multer

Swagger 2.0 middleware and mocks for Express.js

Fork from swagger-express-middleware

The main goal of the fork is to use the latest multer package (multer 1.x) for compatibility with the multer-s3 package that is supposed to be used to upload files to AWS S3.

Installation and Use

Install using npm.

npm install swagger-express-middleware

Then use it in your Node.js script like this:

const express = require('express');
const createMiddleware = require('swagger-express-middleware');

let app = express();

createMiddleware('PetStore.yaml', app, function(err, middleware) {
    // Add all the Swagger Express Middleware, or just the ones you need.
    // NOTE: Some of these accept optional options (omitted here for brevity)
    app.use(
        middleware.metadata(),
        middleware.CORS(),
        middleware.files(),
        middleware.parseRequest(),
        middleware.validateRequest(),
        middleware.mock()
    );

    app.listen(8000, function() {
        console.log('The PetStore sample is now running at http://localhost:8000');
    });
});

Samples & Walkthroughs

License

Swagger Express Middleware is 100% free and open-source, under the MIT license. Use it however you want.

About

Swagger 2.0 middlware and mocks for Express.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%