🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@scalar/hono-api-reference

Package Overview
Dependencies
Maintainers
8
Versions
339
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scalar/hono-api-reference

A middleware for using the Scalar API reference in Hono

0.4.13
Source
npm
Version published
Weekly downloads
57K
-0.32%
Maintainers
8
Weekly downloads
 
Created
Source

Scalar Hono API Reference Plugin

Version Downloads License Discord

This middleware provides an easy way to render a beautiful API reference based on an OpenAPI/Swagger file with Hono.

hono-js

Installation

npm install @scalar/hono-api-reference

Usage

Set up Zod OpenAPI Hono and pass the configured URL to the apiReference middleware:

import { apiReference } from '@scalar/hono-api-reference'

app.get(
  '/reference',
  apiReference({
    spec: {
      url: '/swagger.json',
    },
  }),
)

The Hono middleware takes our universal configuration object, read more about configuration in the core package README.

Themes

The middleware comes with a custom theme for Hono. You can use one of the other predefined themes (alternate, default, moon, purple, solarized) or overwrite it with none. All themes come with a light and dark color scheme.

import { apiReference } from '@scalar/hono-api-reference'

app.get(
  '/reference',
  apiReference({
    theme: 'purple',
    spec: {
      url: '/swagger.json',
    },
  }),
)

Custom page title

There’s one additional option to set the page title:

import { apiReference } from '@scalar/hono-api-reference'

app.get(
  '/reference',
  apiReference({
    pageTitle: 'Hono API Reference',
    spec: {
      url: '/swagger.json',
    },
  }),
)

Custom CDN

You can use a custom CDN ,default is https://cdn.jsdelivr.net/npm/@scalar/api-reference.

import { apiReference } from '@scalar/nestjs-api-reference'

app.use(
  '/reference',
  apiReference({
    cdn: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
    spec: {
      content: OpenApiSpecification,
    },
  }),
)

FAQs

Package last updated on 21 Mar 2024

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