Skip to content

A NestJS auxiliary tool that allows you to view the code module structure through a web UI and quickly generate frontend TypeScript SDK code.

Notifications You must be signed in to change notification settings

826327700/nest-canddy

Repository files navigation

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-canddy

As a Server

If you are a server developer using the nestjs framework:

  1. Add nestcanddy.config.js to 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
	},
}
  1. Next, you can generate the frontend TypeScript SDK code.
nests generate
//or
nests g

nest-canddy-demo-3 3. You can also use the Web UI to view and generate the frontend TypeScript SDK code.

nests server
//or
nests s

nest-canddy-demo-3

As a Client

If you are a frontend developer using TypeScript for any project:

  1. Add nestcanddy.config.cjs to 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
	}
}
  1. Next, you can pull the frontend TypeScript SDK code.
nestc get
//or
nestc g

nest-canddy-demo-3

中文文档

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框架的服务器开发人员:

  1. 在nestjs的项目根目录下新增nestcanddy.config.js
module.exports = {
    server:{
		port: 13270,//作为提供SDK拉取服务的端口号
		outputPath:'./output',//生成SDK的保存目录
	},
}

2.接下来,你可以生成前端Typescript SDK代码。

nests generate
//or
nests g

nest-canddy-demo-3 3.你也可以使用Web UI来查看和生成生成前端Typescript SDK代码。

nests server
//or
nests s

nest-canddy-demo-3

作为客户端

如果你当前的角色是使用Typescript开发任何项目的前端开发人员:

  1. 在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

nest-canddy-demo-3

About

A NestJS auxiliary tool that allows you to view the code module structure through a web UI and quickly generate frontend TypeScript SDK code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published