Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xdp/generate-api

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xdp/generate-api

> 根据 apiDocs 生成api部分代码

  • 1.0.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-28.57%
Maintainers
0
Weekly downloads
 
Created
Source

@xdp/generate-api

根据 apiDocs 生成api部分代码

Usage

安装命名

# npm 安装
npm install -g @xdp/generate-api

添加配置文件

在config文件夹下创建api-config.js

// config/api-config.js
module.exports = [
  {
    key: 'apiName', // proxy-config中的apiName
    target: 'name', // apiDocs所在路径
    dir: 'name', // 生成代码在src/api的文件夹名称
    beforeRequest: ()=> { // 非必填, 当获取json时需要登录地址时可配, 需要返回请求文档时的配置 如 { cookie: 'token'}

    } 
  }
]

生成api代码

# 在项目根目录执行
gen-api

FAQs

Package last updated on 15 Dec 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

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