2.3.6 • Published 30 days ago

@routup/swagger v2.3.6

Weekly downloads
-
License
MIT
Repository
github
Last release
30 days ago

@routup/swagger

npm version main codecov Known Vulnerabilities Conventional Commits

This is a plugin for reading and parsing the request payload.

Table of Contents

Installation

npm install @routup/swagger --save

Documentation

To read the docs, visit https://routup.net

Usage

Generator

Generate a swagger document for the API endpoints.

V2

import { generate, Version } from '@routup/swager';
import process from 'node:process';

await generate({
    version: Version.V2,
    options: {
        metadata: {
            preset: '@routup/swagger-preset',
            entryPoint: {
                cwd: process.cwd(),
                pattern: '**/*.ts',
            },
        },
        output: true,
        outputDirectory: 'writable',
        servers: ['http://localhost:3000/'],
    },
});

The function call will save the file under the location: ./writable/swagger.json.

V3

import { generate, Version } from '@routup/swager';
import process from 'node:process';

await generate({
    version: Version.V3,
    options: {
        metadata: {
            preset: '@routup/swagger-preset',
            entryPoint: {
                cwd: process.cwd(),
                pattern: '**/*.ts',
            },
        },
        output: true,
        outputDirectory: 'writable',
        servers: ['http://localhost:3000/'],
    },
});

The function call will save the file under the location: ./writable/swagger.json.

UI

Serve generated docs from (file- / web-) URL or based on a JSON file with swagger-ui.

import { createServer } from 'node:http';
import {
    createNodeDispatcher,
    Router
} from 'routup';
import { swaggerUI } from '@routup/swagger';

const router = new Router();

router.use('/docs', swaggerUI('test/data/swagger.json'));

const server = createServer(createNodeDispatcher(router));
server.listen(3000);

Now open the browser and visit:

http://localhost:3000/docs/

License

Made with 💚

Published under MIT License.

2.3.6

30 days ago

2.3.5

2 months ago

2.3.4

4 months ago

2.3.2

4 months ago

2.3.3

4 months ago

2.3.1

5 months ago

1.0.2

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

2.3.0

5 months ago

2.0.0-alpha.3

7 months ago

2.2.0

6 months ago

2.0.0-alpha.0

7 months ago

2.1.0

6 months ago

2.0.0

7 months ago

1.0.1

11 months ago

1.0.0

12 months ago

1.0.0-alpha.0

12 months ago

0.13.5

12 months ago

0.13.0

1 year ago

0.13.1

1 year ago

0.13.2

1 year ago

0.13.3

1 year ago

0.13.4

1 year ago

0.12.0

1 year ago

0.12.1

1 year ago

0.11.0

1 year ago

0.11.1

1 year ago

0.10.0

1 year ago

0.3.0

1 year ago

0.9.0

1 year ago

0.2.7

1 year ago

0.8.0

1 year ago

0.2.6

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.3.2

1 year ago

0.2.3

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.7.0

1 year ago

0.2.5

1 year ago

0.6.0

1 year ago

0.2.4

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago