This repository is forked from jwt-bch-api in the PSF repository. It was forked so the Developer Services team can play with the code and evaluate if it's a good fit for our product plan.
This is a prototype REST API webserver written in node.js and using this koa webserver boilerplate app. This prototype back end is intended to be paired with this front end.
This very lightweight API server acts as an auth server. It allows:
- The creation and management of users.
- The persistance of user data (models) in a Mongo Database.
- Users can pay BCH to recieve a JWT token to access a REST API or other web service.
- REST APIs and web services can quickly query this web server to validate JWT tokens.
- node ^10.15.1
- npm ^6.7.0
git clone https://github.com/Permissionless-Software-Foundation/jwt-bch-api
cd jwt-bch-api
npm install
npm start
├── bin
│ └── server.js # Bootstrapping and entry point
├── config # Server configuration settings
│ ├── env # Environment specific config
│ │ ├── common.js
│ │ ├── development.js
│ │ ├── production.js
│ │ └── test.js
│ ├── index.js # Config entrypoint - exports config according to envionrment and commons
│ └── passport.js # Passportjs config of strategies
|
├── production # Dockerfile for build production container
|
├── src # Source code
│ ├── lib # Business logic libraries
│ ├── modules
│ │ ├── controller.js # Module-specific controllers
│ │ └── router.js # Router definitions for module
│ ├── models # Mongoose models
│ └── middleware # Custom middleware
│ └── validators # Validation middleware
└── test # Unit tests
npm start
Start server on live modenpm run dev
Start server on dev mode with nodemonnpm run docs
Generate API documentationnpm test
Run mocha testsdocker-compose build
Build a 'production' Docker containerdocker-compose up
Run the docker container
API documentation is written inline and generated by apidoc.
Visit http://localhost:5001/docs/
to view docs
- koa2
- koa-router
- koa-bodyparser
- koa-generic-session
- koa-logger
- MongoDB
- Mongoose
- Passport
- Nodemon
- Mocha
- apidoc
- ESLint
MIT