配置

通过命令easyApi -h可以查看命令行支持的相关指令。

Usage: easyApi [options]

Options:
  -V, --version              output the version number
  -i, --input <file>         input file or directory, must be specified
  -o, --output <path>        output api doc file directory, default will create a "api_doc" folder in current working directory
  -c, --config <file>        the config.js file, default will look for "easy.config.js" in current working directory
  -s, --server [serveraddr]  static server host, default will use "localhost"
  -p, --port <port>          static server port, default will use 9527
  -h, --help                 output usage information

默认easyApi会读取当前目录下的easy.config.js文件(若存在的话),当做配置,若同时提供命令行参数,命令行参数会覆盖easy.config.js里面相同参数配置。

# easy.config.js
const config = {
  "version": "",  // api对应的版本 默认为1.0.0
  "title": "", // 文档的title 默认为easyApi
  "input": "", // 生成文档的源文件所在目录
  "output": "", // 生成文档文件所在的目录,默认为api_doc
  "baseUrl": "", // api请求示例时,增加的统一前缀
  "server": "localhost", // 本地服务的host,默认为localhost
  "port": 9527, // 本地服务的端口,默认为9527
  // "proxy": { // api请求的代理配置
  //   "/api": {
  //     "target": "http://localhost:5000",
  //     "changeOrigin": true
  //   }
  // }
}

module.exports = config;

results matching ""

    No results matching ""