Coder Social home page Coder Social logo

joannamo / egg-restapi-module-tool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fomenyesu/egg-restapi-module-tool

0.0 1.0 0.0 1.38 MB

a example of eggjs, react, antd, dva, webpack, mysql, restful api and other stuff made it work...

JavaScript 26.42% CSS 73.33% HTML 0.25%

egg-restapi-module-tool's Introduction

Egg Restapi Module Tool

a example of eggjs2.0, react, antd, dva2.0, webpack, mysql, restful api and other stuff made it work...

you can generate rest api eazily by this tool.

中文 README

update note:

2017-07-10 initial

2017-12-01 update login module with oauth2.0

2018-01-03 update dva to dva2.0

2018-01-04 update egg to egg2.0

Examples for egg

use react, Antd and dva to develop front end modules. use eggjs and mysql to be backend. you can use npm run dev to develop both side's service. or use it as a boilerplate.

this example include two modules: 1 modules manager : module table's CRUD operation, 2 request manager : an note for restful api witch is generated by module tool.

Develop

Installation

install mysql start mysql import testdb.sql to mysql

npm i egg-bin --save-dev
npm install

Start up:

run npm to start server

npm run dev

Go to http://localhost:8080

also you can : npm run dev_static to start front react project npm run server to start egg server npm run dev to start both

Distribute

$ npm run build
$ npm run pro

npm run build to build the front end react project. npm run pro in server to start project on you server visit http://serverIP:7001

REST API Example

api/restql/users GET List

{
"meta":{"total":3},
"data":[
{"_id":"58d8a899f5f2486f1f6d4236","uid":1,"name":"admin","pass":"123","status":1,"time":"1325472736"},
{"_id":"58db7828a14b14815447cf33","name":"sdf","pass":"123","status":1,"time":"1325472736","uid":3,"__v":0},
{"_id":"58db7d3bcee4d48df6f5bdfd","name":"sdddf","pass":"123","status":1,"time":"1325472736","uid":4,"__v":0}
]
}

api/restql/users/1 GET Single Data

{
"meta":{"total":1},
"data":[
{"_id":"58d8a899f5f2486f1f6d4236","uid":1,"name":"admin","pass":"123","status":1,"time":"1325472736"}
]
}

api/restql/users/2 PUT Update data with uid

{"name":"admin123","pass":"123","status":1,"time":"1325472736"}

api/restql/users POST insert data

{"name":"admin123","pass":"123","status":1,"time":"1325472736"}

same with news and news_type for rest api data.

screen shot

login.png page1.png page2.png page3.png

Thank you

egg

ant-design

antd-admin

egg-restapi-module-tool's People

Contributors

fomenyesu avatar

Watchers

 avatar

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.