0.5.0 • Published 2 years ago

node2api v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

node2api

A CLI plugin to generate client request SDK from nodejs server projects

Installation

$ npm i -g node2api

You may also install locally

Usage

$ node2api [--config file] [--stream] [--help]

Local usage

$ npm i -D node2api

package.json

{
  "scripts": {
    "sync": "node2api"
  }
}
$ npm run sync

Config

Add node2api.json file to your project root.

Here is an example

{
  "input": {
    "parser": "nestjs",
    "sources": [
      "./server/src/**/*.controller.ts",
      "!./server/src/health/**/*.ts"
    ],
    "types": [
      "./server/src/**/*.{dto,entity}.ts",
      "./server/types/**/*.d.ts",
      "!./server/types/config.d.ts"
    ]
  },
  "output": {
    "writer": "axios",
    "dest": "./client/src/api/index.ts",
    "httpModule": "./client/src/api/http.ts",
    "options": "opts",
    "comment": "/* eslint-disable */\n/* AUTO GENERATED. DO NOT CHANGE */",
    "formatSettings": {
      "indentSize": 2
    }
  }
}

Check src/config.d.ts for full definition.

Batch mode

Config can be an array to enable batch mode

0.3.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.2.3

2 years ago

0.4.0

2 years ago

0.2.4

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago