Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@scalar/hono-api-reference
Advanced tools
A middleware for using the Scalar API reference in Hono
This middleware provides an easy way to render a beautiful API reference based on an OpenAPI/Swagger document with Hono.
npm install @scalar/hono-api-reference
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: '/openapi.json',
},
}),
)
The Hono middleware takes our universal configuration object, read more about configuration in the core package README.
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: '/openapi.json',
},
}),
)
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: '/openapi.json',
},
}),
)
You can use a custom CDN ,default is https://cdn.jsdelivr.net/npm/@scalar/api-reference
.
You can also pin the CDN to a specific version by specifying it in the CDN string like https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.28
You can find all available CDN versions here
import { apiReference } from '@scalar/hono-api-reference'
app.use(
'/reference',
apiReference({
cdn: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest',
spec: {
url: '/openapi.json',
},
}),
)
We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar
The source code in this repository is licensed under MIT.
FAQs
A middleware for using the Scalar API reference in Hono
We found that @scalar/hono-api-reference demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.