Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nest-canddy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
English Document
中文文档,如果github访问不了,本页面后半部分为中文文档。 更详细的中文文章
nest-canddy
nest-canddy is a non-intrusive CLI tool that can quickly generate TypeScript SDK code for the frontend to make HTTP requests. It also provides a visual web UI interface to simply display the project module structure.
Features
- Quickly generate TypeScript SDK code for making RESTful requests on the frontend
- Provide a Web UI visualization interface
Installation
You can install nest-canddy via npm or yarn:
yarn add -g nest-canddy
//or
npm install -g nest-canddyAs a Server
If you are a server developer using the nestjs framework:
- Add
nestcanddy.config.jsto the root directory of the nestjs project
module.exports = {
server:{
port: 13270,//Port number for providing SDK pull service
outputPath:'./output',//Directory to save the generated SDK
},
}- Next, you can generate the frontend TypeScript SDK code.
nests generate
//or
nests g
3. You can also use the Web UI to view and generate the frontend TypeScript SDK code.
nests server
//or
nests s
As a Client
If you are a frontend developer using TypeScript for any project:
- Add
nestcanddy.config.cjsto the root directory of the nestjs project
module.exports = {
client:{
host: 'localhost:13270',//Backend SDK service address
outputPath:'./output',//Relative path to output the SDK in the current project
httpAdapterPath:'axios',//Path to the HTTP request adapter
httpAdapterName:'axios',//Name of the HTTP request adapter
responseWrapperType:'{AxiosResponse}',//Return type wrapper type
responseWrapperTypePath:'axios',//Return type wrapper type path
}
}- Next, you can pull the frontend TypeScript SDK code.
nestc get
//or
nestc g
中文文档
nest-canddy
nest-canddy 是一个无侵入代码的CLI工具,它可以快速生成前端可用的TypeScript SDK代码,用于发起http请求。同时,它还提供一个可视化的web ui界面,用于简单的展示项目模块结构。
功能
- 快速生成前端用于发起RESTful请求的TypeScript SDK代码
- 提供Web UI可视化界面
安装
你可以通过npm或yarn安装nest-canddy:
yarn add -g nest-canddy
//or
npm install -g nest-canddy作为服务端
如果你当前的角色是使用nestjs框架的服务器开发人员:
- 在nestjs的项目根目录下新增
nestcanddy.config.js
module.exports = {
server:{
port: 13270,//作为提供SDK拉取服务的端口号
outputPath:'./output',//生成SDK的保存目录
},
}2.接下来,你可以生成前端Typescript SDK代码。
nests generate
//or
nests g
3.你也可以使用Web UI来查看和生成生成前端Typescript SDK代码。
nests server
//or
nests s
作为客户端
如果你当前的角色是使用Typescript开发任何项目的前端开发人员:
- 在nestjs的项目根目录下新增
nestcanddy.config.cjs
module.exports = {
client:{
host: 'localhost:13270',//后端提供的SDK服务地址
outputPath:'./output',//SDK输出到当前项目的相对路径
httpAdapterPath:'axios',//发起http请求的适配器引用路径
httpAdapterName:'axios',//发起http请求的适配器引用名称
responseWrapperType:'{AxiosResponse}',//返回类型包裹类型
responseWrapperTypePath:'axios',//返回类型包裹类型路径
}
}2.接下来,你可以拉取前端Typescript SDK代码。
nestc get
//or
nestc g