Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

@xdp/generate-api

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xdp/generate-api

> 根据 apiDocs 生成api部分代码

npmnpm
Version
1.0.1
Version published
Maintainers
0
Created
Source

@xdp/generate-api

根据 apiDocs 生成api部分代码

Usage

安装命名

# npm 安装
npm install -g @cip/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 12 Jul 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