RESTful Service
- You must be a member and added ssh key of workspace on bitbucket/gitlab. Clone the repo
git clone- Framework ExpressJS v4.
- Validation API with Joi and fastest validator.
- Validate and generate default config environment.
- Authenticate JSON Web Token and auto refresh token in header.
- Handle permission user when calling API.
- Storage data on MongoDB.
- Data Source built with Apollo datasource and Dataloader.
- Caching result with Redis.
- Logging in winston.
- Documentation with Swagger.
- Compiler with Babel ES6.
- Auto create the first user (username: "admin", password: "123456)
This is an example of how to list things you need to use the software and how to install them.
-
NodeJS v14.4.x to up
-
MongoDB v4.x
-
Redis v5.x
Follow all step bellow to setup your dev environment
-
Setup as
Installing / Getting started -
Start your environment (We are using Docker for environment setup)
-
Setup environment variables. Create environment config file and config
mongo,rabbitmqandredisconnection paramsGenerate secret token:
head -n 4096 /dev/urandom | openssl sha1Paste the result into JWT_ACCESS_TOKEN_SECRET, JWT_REFRESH_TOKEN_SECRET in .env file
cp .env.example .env- Install NPM packages
yarn install- Run development:
yarn devYou can start via docker compose
docker-compose upTest your code before build.
$ yarn test:coverageRun build command
$ yarn buildPush your code to your branch with format [__YOUR_USERNAME__]/[__FEATURE__]
$ git add .
$ git commit -m "__COMMIT_MESSAGE__"
$ git push origin [__YOUR_USERNAME__]/[__FEATURE__]Then go to repository server and make a pull request to branch development.
IMPORTANT: Don't push anything to master by yourself. A CI tool will run all step and merge to master for you.
- Install dependencies in production
yarn install --production=true- Using swagger doc
- Document: http://localhost:9000/documentation
- Health Check: http://localhost:9000/health
On .env, you must config all environment variables bellow. By default, .env.example is used default config for all service.
The test library is Jest.
-
All test files must be located on
__tests__and naming by format[name].spec.js -
The folders/files on
__tests__must be as same as onsrcfolder.
Just test
yarn testTest a file
yarn test path/to/test/fileTest with coverage information
yarn test:coverage-
[Current]
beta: All code is onmaster -
v1.0.0
Dev Team – @DEV – dev@kompa.ai