Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

midway-scalar

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midway-scalar

Midway.js component for Scalar API Reference integration

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

midway-scalar

Midway.js 组件,用于集成 Scalar API Reference,提供美观的 API 文档展示界面。

Scalar API Reference Preview

功能特性

  • 集成 Scalar API Reference 到 Midway.js 应用
  • 自动读取 Swagger 配置生成 API 文档
  • 支持自定义 Scalar 配置选项
  • 提供 /scalar 路由访问 API 文档

安装

npm install midway-scalar
# 或
pnpm add midway-scalar

使用

1. 配置组件

src/configuration.ts 中引入组件:

import { Configuration } from '@midwayjs/core';
import * as scalar from 'midway-scalar';

@Configuration({
  imports: [scalar],
})
export class MainConfiguration {}

2. 配置 Scalar

src/config/config.default.ts 中配置:

export default {
  swagger: {
    title: 'API 文档',
    description: 'API 接口文档',
    version: '1.0.0',
  },
  scalar: {
    theme: 'purple',
    darkMode: true,
  },
} as MidwayConfig;

3. 访问文档

启动应用后,访问 http://localhost:7001/scalar/ 查看 API 文档。

配置选项

更多配置选项请参考官方文档:Scalar

License

MIT

Keywords

midway

FAQs

Package last updated on 12 Jan 2026

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