Starter API Rest in NodeJS to consume Humming Bird API Rest by PodGroup
- Download or clone this repo
git clone https://github.com/Gabrirf/humming-bird-client.git- Install npm dependencies
npm i- Copy & configure env file
npm run copy:envYou must insert your Humming Bird API username and password on variable.
- Build docker image and deploy app
npm run compose:appOr simply run on your local with npm start for develop.
- By default, the app deploy on port 3000 and all requests are versioned under
/v1path. To use the app you can:- SwaggerUI go to localhost:3000/docs to see swagger playground
- Postman Use the provided postman collectión.
📦humming-bird-client
┣ 📂.vscode
┃ ┗ 📜launch.json # Debugging configuration file
┣ 📂docker
┃ ┣ 📜docker-compose.app.yml # Build and deploy app
┃ ┗ 📜docker-compose.test.yml # Deploy Sonarqube
┣ 📂src
┃ ┣ 📂config # Modules configurations
┃ ┣ 📂controllers # API controllers
┃ ┣ 📂helpers # Common modules to make code easier
┃ ┃ ┣ 📂errors
┃ ┃ ┣ 📂logger
┃ ┃ ┣ 📂utils
┃ ┣ 📂loaders # Setup server and services on load
┃ ┣ 📂middlewares # API middlewares
┃ ┣ 📂openapi # Openapi (Swagger v3) specification
┃ ┃ ┣ 📂examples
┃ ┃ ┣ 📂responses
┃ ┃ ┣ 📂schemas
┃ ┃ ┣ 📂security
┃ ┣ 📂routes # API routes
┃ ┃ ┗ 📂v1
┃ ┣ 📂services # External services
┃ ┣ 📜app.js # App main
┃ ┣ 📜config.js # Centralize user variables
┃ ┗ 📜index.js # Launch app
┣ 📂test
┃ ┣ 📂unit
┃ ┃ ┣ 📂controllers
┃ ┃ ┣ 📂loaders
┃ ┃ ┣ 📂middlewares
┃ ┃ ┗ 📂services
┃ ┣ 📂utils
┃ ┗ 📜sonar.js
┣ 📜.dockerignore
┣ 📜.editorconfig
┣ 📜.env
┣ 📜.eslintrc.js
┣ 📜.gitignore
┣ 📜Dockerfile
┣ 📜LICENSE
┣ 📜README.md
┣ 📜env.template
┣ 📜package-lock.json
┗ 📜package.jsonexpressexpress-openapiswagger-ui-expressmorganwinstongot
By using npm script, you can see and fix all linter errors and warning
npm run lintnpm run lint:fix
There are npm script created to easily run test:
npm run testnpm run test:watchnpm run test:reportMust be sonarqube running- To run sonarqube server:
npm run compose:test - First time deploy: user admin, password: admin
- change password to adminadmin
- After the report go to localhost:9000 and see analysis
- To run sonarqube server: