项目作者: wrannaman

项目描述 :
API Generator - instantly generate REST and GraphQL APIs (openapi (OAS) 3.0.0)
高级语言: JavaScript
项目地址: git://github.com/wrannaman/generators.git
创建时间: 2019-06-02T03:05:54Z
项目社区:https://github.com/wrannaman/generators

开源协议:MIT License

下载


Rest/GraphQL APIs + React Components Generator 🔥

Buy Ligit License
Follow on Twitter
Average time to resolve an issue
Percentage of issues still open
npm package
NPM Downloads

Sugar Generator - API Edition

App Demo

This project is sponsored by

SponsoredBy.dev

Quick Start

  1. Install the npm module
  1. # install
  2. npm i -g sugar-generate
  1. Create a json schema save, this to monkey.json
  1. {
  2. "name": "monkey",
  3. "schema": {
  4. "name": {
  5. "type": "String",
  6. "default": ""
  7. },
  8. "alive": {
  9. "type": "Boolean",
  10. "default": false
  11. },
  12. "age": {
  13. "type": "Number",
  14. "default": false
  15. }
  16. }
  17. }
  1. Generate your api and app
  1. sugar-generate \
  2. --schema monkey.json \
  3. --destination ./my-monkeys

Boom, you now have:

API:

  • GraphQL API
  • REST API
  • Working Tests

APP:

  • React create item form
  • React table that supports
    • search
    • sort
    • filter
    • pagination
    • edit item
    • create item

Start the API

  1. cd ./my-monkeys/api
  2. npm i
  3. npm run start
  4. # http://localhost:7777

Start the APP

  1. cd ./my-monkeys/app
  2. npm i
  3. npm run dev
  4. # http://localhost:3000

Behold Magic

A fully functioning react table and form with searching sorting filtering, editing, adding, global search, download, and refresh.

SugarKubes Generated App

Links

GraphQL is on localhost:7777/graphql

Swagger is on localhost:7777

APP is on localhost:3000

API is on localhost:7777

Documentation

API Documentation (generated back end)

App Documentation (generated front end)

Experimental Embeddable Components

What if you could remotely update your components without having to push new code?

Thats one question we’re exploring with the experimental embeddable react components. There are of course cool ways to serve single pages as serverless functions but what’s cooler would be a way for even non-technical people to update a database schema and a form or table in real time without writing any code.

  • Each component comes out in an embeddable format under /embed
  • TBD - How to easily deploy these and use them.
    -

Updates

  • 8/5/19 support for mongo arrays in documents