Giter Club home page Giter Club logo

node-erest's Introduction

NPM version build status Test coverage David deps node version npm download npm license DeepScan grade

node-erest

通过简单的方式构建一个优秀的 API 服务(基于 express、@leizm/web 等)。

一个优秀的 API 必须要有优秀的文档、较完整的测试,同时便于开发部署与联调。在文档方面,最大的问题在于,随着 API 的发展需要找人同步更新文档。有个更好的方案是不脱离代码自更新文档。

通过 ERest,你可以在定义 API 的同时,完成参数模型的定义、API格式的定义,同时生成便于写 API 测试的脚手架,像调用本地方法一样写 API 测试,并自动完成 API 文档的生成(包括示例数据),同时生成 Swagger、Postman、基于 axios 的 js-sdk(更多功能支持自定义)。

使用 (generator-erest)[https://github.com/yourtion/node-generator-erest] 帮助你快速生成一个 API 项目框架。

Install

$ npm install erest --save

Use yeoman generator

$ npm install generator-erest -g
# Express
$ yo erest:express
# @leizm/web
$ yo erest:lei-web

How to use

'use strict';

const API = require('erest').default;

// API info for document
const INFO = {
  title: 'erest-demo',
  description: 'Easy to write, easy to test, easy to generate document.',
  version: new Date(),
  host: 'http://127.0.0.1:3000',
  basePath: '/api',
};

// API group info
const GROUPS = {
  Index: '首页',
};

// Init API
const apiService = new API({
  info: INFO,
  groups: GROUPS,
});

apiService.api.get('/index')
  .group('Index')
  .title('Test api')
  .register((req, res) => {
    res.end('Hello, API Framework Index');
  });

const express = require('express');
const app = express();
const router = new express.Router();
app.use('/api', router);

// bing express router
apiService.bindRouter(router, apiService.checkerExpress);

app.listen(3000, function () {
  console.log('erest-demo listening started');
});

node-erest's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar yourtion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-erest's Issues

An in-range update of @tuzhanai/schema-manager is breaking the build 🚨

The dependency @tuzhanai/schema-manager was updated from 1.1.0 to 1.1.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@tuzhanai/schema-manager is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 1 commits.

  • fdc6c30 fix: 更新@tuzhanai/value-type-manager

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of supertest is breaking the build 🚨

Version 3.2.0 of supertest was just published.

Branch Build failing 🚨
Dependency supertest
Current Version 3.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

supertest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes v3.2.0
Commits

The new version differs by 29 commits.

  • c52338b Merge pull request #508 from visionmedia/prepare-release
  • fb3d042 chore(package*.json) version bumped v3.2.0
  • 8707c22 doc(History.md) file updated
  • 05272d7 Merge pull request #507 from visionmedia/upgrade-dependencies
  • 011d008 chore(.gitignore) coverage folder included
  • 92578c7 Merge pull request #503 from visionmedia/upgrade-dependencies
  • 1fc760b chore(package-lock.json) locker file updated
  • f8229a8 Merge branch 'master' into upgrade-dependencies
  • 979999f Merge pull request #506 from rimiti/fix-pipeline
  • 96af26a chore(.gitignore) .nyc_output folder included
  • b0a9dbd chore(.travis.yml) call npm coverage script
  • c4566f2 chore(package-lock.json) file updated
  • 85b17c6 chore(package.json) coverage script created
  • 977081f Merge pull request #504 from visionmedia/adding-coverage
  • 0a3ad28 Merge remote-tracking branch 'origin/master' into adding-coverage

There are 29 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ts-node is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency ts-node was updated from 8.7.0 to 8.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for [Perf] List File Names

Added

  • Add sanitize=true to README for SVGs to work on NPM

Fixed

  • Simplify projectVersion++ by incrementing on each file change
  • List all files for getScriptFileNames (#985) - revisits the change in #884

v8.7.0...v8.8.0

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ts-node is breaking the build 🚨

The devDependency ts-node was updated from 8.0.2 to 8.0.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for Relative TypeScript

Added

  • Fall back on resolving relative TypeScript packages (normal resolution is from working directory, these two things can be the same in the case of locally installed packages)
Commits

The new version differs by 10 commits.

  • 8706c31 8.0.3
  • d065dd2 Update README note about relative installations
  • 655c43b Fallback on resolving TypeScript relatively (#793)
  • c2ecc7d Add note about local TypeScript to README (#789)
  • 7414752 Update README with triple-slash directive example (#776)
  • efaf67a Add VS Code env note to README (#738)
  • 2609663 Avoid incrementing memory cache unnecessarily
  • b4bdb08 Specify sensitive file names for document registry
  • c215693 Utilize TypeScript sys better for service host
  • 062254f Conditionally enable .[tj]sx extensions

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/jest is breaking the build 🚨

Version 23.3.2 of @types/jest was just published.

Branch Build failing 🚨
Dependency @types/jest
Current Version 23.3.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of coveralls is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency coveralls was updated from 3.0.9 to 3.0.10.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

coveralls is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for CodeFresh support, Maintenance

Added:

  • CodeFresh support (@suda)

Improved:

Updated:

Commits

The new version differs by 6 commits.

  • 2ea7be3 bump version
  • 5e976c5 Only coverage report on test success, fixes #230
  • 3d83b4f Set service_name and/or repo_token from .coveralls.yml regardless of if $COVERALLS_REPO_TOKEN is set (#272)
  • 710c504 Add Codefresh support
  • 8c4ba99 CI: switch to actions/checkout@v2
  • eb1a3c9 278 Upgrades minimist dependency to 1.2.5

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

support API version

  • add API-Version in header
  • support register different function for router
api
  .get("/test")
  .group("Base")
  .query({
    name: build(TYPES.String, "名字", true),
  })
  .title("测试路由")
  .version(">6", newfunc)
  .version("<=5", org)

An in-range update of ts-jest is breaking the build 🚨

Version 23.1.0 of ts-jest was just published.

Branch Build failing 🚨
Dependency ts-jest
Current Version 23.0.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 39 commits.

  • 6916e7b Merge pull request #650 from kulshekhar/kulshekhar-patch-1
  • 54a30eb Bump the version (minor)
  • 9e61969 Merge pull request #626 from huafu/feature/upgrade-babel-and-fix-tsconfig
  • ef21f50 Merge branch 'master' into feature/upgrade-babel-and-fix-tsconfig
  • c67ba4d Merge pull request #649 from kulshekhar/greenkeeper/monorepo.react-16.4.2
  • 9a6904f Merge branch 'master' of https://github.com/kulshekhar/ts-jest into feature/upgrade-babel-and-fix-tsconfig
  • 8a94008 chore(package): update react-test-renderer to version 16.4.2
  • 6e73fb9 chore(package): update react to version 16.4.2
  • c947791 chore(package): update @types/node to version 10.5.5 (#646)
  • fd24ae6 Merge pull request #640 from jmheik/to-dev-deps
  • e2028da Merge branch 'master' into to-dev-deps
  • 4396dde Merge pull request #641 from jeznag/patch-1
  • 7d78123 Merge branch 'master' into patch-1
  • b38e4ca Add TypeScript ^3.0.0 as supported peer dependencies (#644)
  • 1e287f3 Add more details on using module name mapper

There are 39 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of supertest is breaking the build 🚨

The devDependency supertest was updated from 3.3.0 to 3.4.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

supertest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v3.4.0
  • PR-532 - Packages updated, pipeline more explicit, documentation updated (thanks @rimiti)
  • PR-517 - Documentation updated (thanks @oprogramador)
  • PR-513 - Use more robust Array instance check (thanks @rubendg)
Commits

The new version differs by 14 commits.

  • 5640ac9 3.4.0
  • 60f8a9e Merge pull request #532 from visionmedia/v3.4.0
  • 43bfae1 doc(History.md) changelog updated
  • fc1568d doc(README.md) cookie example added
  • 3192d96 chore(package-lock.json) file updated
  • b3d271f chore(package.json) blocks reorganized, nock removed
  • aeae0f3 chore(.travis.yml) pipeline more explicit
  • 53feddc chore(test/supertest.js) obscure test removed
  • 50c59d6 Merge pull request #519 from oprogramador/patch-3
  • 6ca3897 Merge pull request #517 from oprogramador/patch-2
  • 0146d81 auth info in README
  • d853b37 fix typo in README
  • 8158979 Merge pull request #513 from rubendg/use-isarray
  • 550613b Use more robust Array instance check

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

supertest error in production env

Error: Cannot find module 'supertest'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (node_modules/erest/dist/lib/agent.js:14:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

An in-range update of @types/node is breaking the build 🚨

Version 10.5.4 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 10.5.3
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @leizm/web is breaking the build 🚨

Version 2.3.1 of @leizm/web was just published.

Branch Build failing 🚨
Dependency @leizm/web
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@leizm/web is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 3 commits.

  • faf52bd feat(component): 增加jsonParser(),比bodyParser.json()性能更好
  • 64516eb README: update
  • cb4210a publish: 2.3.0

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @tuzhanai/schema-manager is breaking the build 🚨

The dependency @tuzhanai/schema-manager was updated from 1.1.1 to 1.1.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@tuzhanai/schema-manager is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 1 commits.

  • 89c0517 feat: update value-type-manager

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/supertest is breaking the build 🚨

Version 2.0.6 of @types/supertest was just published.

Branch Build failing 🚨
Dependency @types/supertest
Current Version 2.0.5
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/supertest is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/jest is breaking the build 🚨

The devDependency @types/jest was updated from 23.3.9 to 23.3.10.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.