Socket
Socket
Sign inDemoInstall

grand-swagger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grand-swagger

A grandjs helper package for generating swagger documentation from json


Version published
Maintainers
1
Created
Source

Grandjs logo

Grandjs Swagger

A grandjs helper package for generating swagger documentation from json

Content

About Installing Usage Example Render Swagger Component

About

This package is developed for grandjs framework to allow you write swagger documentation for your Grandjs Application!

Installing

Tou Install Grand-swagger you just need to write the following command!

npm i grand-swagger

Usage

Grand Swagger exposed to you a simple jsx component that you can use to render your swagger documentation easily!

Example

import {SwaggerComponent} from "grand-swagger";

Render Swagger Component

To render Grand Swagger Component you can define a new route and in the handler you can use res.render to render this component, this component takes the following properties

propertytyperequireddescription
docsobjecttruethis property is an object which implies your swagger documentation that you want to show

Rendering Example

import {Server, Router} from "grandjs"
import {SwaggerComponent} from "grand-swagger";
import docs from "./doc.json";

class MainRouter extends Router{}

const mainRouter = new MainRouter({base: "/"});

mainRouter.addRoute({
    url: "/docs",
    method: "GET",
    handler: (req, res) => {
        res.render(SwaggerComponent, {docs: docs})
    }
})

Keywords

FAQs

Package last updated on 12 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc