Using the example made by koa2 and oauth2, the project uses mongodb and redis for data management, in which mongodb performs data query, and redis manages the token in oauth2;
This project uses node and npm. Please make sure you install them locally -Use npm
$ npm i
-Or yarn, of course tyarn is recommended for inland China
$ npm install yarn -g
$ yarn
$ yarn run start
$ yarn run prod # Need to install pm2
-Access in browser
http://localhost:7001
|-- .eslintignore
|-- .eslintrc
|-- .gitignore
|-- app.js
|-- package.json
|-- readme-zh.md
|-- readme.md
|-- bin
| |-- www
|-- public
|-- src
| |-- config
| | |-- index.js
| |-- mongoose
| | |-- index.js
| | |-- models
| | |-- clientModel.js
| | |-- userModel.js
| |-- oauth
| | |-- compatibleTokenError.js
| | |-- errorCode.js
| | |-- index.js
| | |-- model.js
| |-- redis
| | |-- index.js
| |-- routes
| | |-- index.js
| | |-- router.spec.js
| |-- utils
| |-- errorHandle.js
| |-- httpException.js
| |-- log4j.js
| |-- res.js
| |-- tool.js
| |-- tool.spec.js
|-- test
|-- restClient.http
- config: configuration file, please refer to ioredis, log4js, mongoosejs
- mongoose: Process all operations of mongoose
- oauth: handle oauth2 authentication, currently supported modes are: password and refresh_token
- redis: Process redis requests
- routes: Process routing
- util: all tools
- test/restClient.http: simple request example
You are very welcome to join! Mention a Issue or submit a Pull Request. The standard Readme follows the Contributor Covenant code of conduct.
MIT @yy921010