Gateway Microservice
A simple and powerful gateway microservice.
Setting up the project
Follow this steps but first! For each parameter go to Environment Configuration to read the documentation.
1- Open the .env file located in the project root folder and change the configuration as desired. For each parameter go to Environment Configuration documentation. 2- High recommended to change the swaggeer username and password to read the documentation for security reasons.
Instructions to run the project
In the temrinal browse to the project folder and type:
1 - To install the dependencies
npm install
2a - To run the application in development mode
npm watch
2b - To run the application in production mode
npm start
Swagger Documentation
After you run the project you can go to the URL: /swagger/api-docs to read the api docs. THe username and password can be found in the Swagger environment configuration.
Environment Configuration
The configuration is in the .env file located in the root folder.
System
SYSTEM_CONTROLLER_PATH
Type: string
Default: ./src/application/controller
The controller folder path. Basically you should not change this value unless you know what you are doing.
Server
NODE_ENV
Type: string
Default: development
Possible values: development | production
The environment execution mode.
SERVER_PORT
Type: integer
Default: 3001
A port number to run the microservice.
SERVER_X_API_KEY
Type: string
Default: 8551ded4-83c0-44d2-8fb5-6b3687282e8a
A static api key string that must be passed in the HTTP header when calling the API.
Header key: X-Api-Key
SERVER_TIMEZONE
Type: string
Default: UTC
The application timezone, this is a specific environment variable for process.env.TZ.
LOGGER_TRANSPORTS
Type: array
Default: file
Possible values: console | file | timber
The transport layers for Winston logger module, basically where the logs will be dispached, it is an array of strings so if you want to log it in console and file together use it with comma separation. Timber is a cloud log provider, you need to create an account to use it and configure the parameters. [ORGANIZATION_KEY, SOURCE_ID]
LOGGER_LOG_FILENAME
Type: string
Default: /log/application.log
The filepath location for LOGGER_TRANSPORTS when file transport is active.
LOGGER_LOG_LEVEL
Type: string
Default: info
Possible values: debug | file | silly | info | warn | error
The log level.
LOGGER_TIMBER_ORGANIZATION_KEY
Type: string
Api key of you Timber account
LOGGER_TIMBER_SOURCE_ID
Type: integer
Source id of you Timber account
SWAGGER_USERNAME
Type: string
Default: admin
The username to read the aoi docs.
SWAGGER_PASSWORD
Type: string
Default: 123456
The user password to read the aoi docs.
JWT_SECRET_KEY
Type: string
Secret jet to encode and decode jwt.
JWT_HOURS_TO_EXPIRE
Type: integer
Default: 24
Amount of hours the token will be valid.
WEB_CLIENT_DATABASE_URL
Type: string
Full url of database service MariaSQL Microservice
WEB_CLIENT_DATABASE_X_API_KEY
Type: string
X-Api-Key header to access the database service resources.
Feedbacks / Contributions
If you want to give feedback or contribute to this project please contact me: leandro.curioso@gmail.com