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.
-
Removes babel as a dependency. This repository is now naively compatible with node v8.9 or higher.
-
Replaced
bcrypt
dependency withbcryptjs
. This improves compatibility across versions of node.js and across OSs. -
Configured for Jenkins (continuous integration), Coveralls (code coverage), Green Keeper (automated dependency management), and Semantic Release (automated versioning).
-
'Production' environment is targeted for packaging as a Docker container.
-
'admin' user type added in addition to standard 'user' type. Allows the creation of private vs public APIs that only be accessed by an admin. Useful for privileged commands like updating and deleting other users.
-
Winston logging integrated for daily rotated logs and a maximum size of 1 megabyte.
-
Linting enforced with Husky and JavaScript Standard Style rules.
This project covers basic necessities of most APIs.
- Authentication (passport & jwt)
- Database (mongoose)
- Testing (mocha)
- Doc generation with apidoc
- Linting using standard
- Packaged as a Docker container
- 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