Git Product home page Git Product logo

share-api's Introduction

Share API

node platform

version license language download pr

查看中文README

Introduction

Based on Swagger and Swagger Open API 2.0 Specification, a tool for generating API documentation by configuring Swagger JSON.

Features

  • More friendly UI
  • More intuitive display
  • Support for enum display
  • Support for both public and private displays
  • Support for configuring IP access whitelist for private API documentation
  • Support for privatization deployment

预览

Version 1.1.0

  1. Support for secondary path
  • In some cases, you need to use www.example.com/scopePath to access, instead of directly accessing the domain name www.example.com
  • Now scopePath is a configurable item
  1. Rewritten the setting related code, the form validation is completely taken over by antd

  2. Added enablePrivate configuration, which is disabled by default. When enabled, it will enable the distinction between private and non-private interfaces.

  • Some switches do not require private configuration by switching on and off the switch that controls the private configuration.
  • The previous design caused the use to be too complicated. If no IP whitelist is configured, you need to enter a password to access the configuration item.

More Change Logs

Quick Start

Providing 2 ways to start

1. Install from npm

  1. Download npm Package
npm i @shuangren/share-api
yarn add @shuangren/share-api
  1. Create new js file and import
// index.js
const ApiDoc = require('@shuangren/share-api');
const doc = new ApiDoc();
doc.start();
  1. Startup
node index.js

Install from Git

  1. Clone repository
git clone https://github.com/ShuangRen/share-api.git
  1. Install dependencies
npm install
yarn
  1. Startup
node dist/server/start.js

Extended configuration

Install from npm

// index.js
const ApiDoc = require('@shuangren/share-api');
const doc = new ApiDoc();
doc.config({
  port: '3001',
  password: 'abc123',
  dataPath: '/var/demo/data.config'
});
doc.start();

Install from Git

Directly modify the configuration in the file dist/server/config

Configuration instructions

dataPath data file that caches interface configuration list , Default dist/server

password password when switched to internal access mode, Default is 123456

port start port Default is 8081

ipList An IP list that runs direct internal access, Default is []

scopePath After enabling, Access using www.example.com/scopePath, Default is empty string, showed proxy-pass, shareapi-static to node server

enablePrivate enable private config, Default is false

Whole configuration reference

doc.config({
  port: '3001',
  password: 'abc123',
  dataPath: '/var/demo/data.config'
  ipList:[
    '192.168.1.111',
    '21.221.1.111'
  ],
  scopePath = 'abc',
  enablePrivate = true
});

share-api's People

Contributors

shuangren avatar xunge0613 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

share-api's Issues

不能正确部署

根据文档使用了2中方法 都报错,报错如下:

/home/ubuntu/shareAPI/node_modules/koa/lib/application.js:62
  listen(...args) {
         ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/ubuntu/shareAPI/node_modules/@shuangren/share-api/server/app.js:39:11)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.