Clone this repository into your working folder and run the following commands (i used yarn):
$ yarn install
$ yarn build
Create .env
file and define all not optional variables. (see env variables)
Make api calls to localhost:3000 with your api client.
If you want to test your changes localy for the first time run yarn test
. This creates a dummy database insert.
Variable | Description | Type | Default | Optional |
---|---|---|---|---|
PORT | Port the api uses | number | 3000 | yes |
JWT_TOKEN | JWT secret | string | - | no |
SALT_WORK_LENGTH | Length of the generated salt | number | 10 | yes |
MYSQL_HOST | MySQL hostname | string | - | no |
MYSQL_DATABASE | MySQL database | string | - | no |
MYSQL_USER | MySQL user | string | - | no |
MYSQL_PASSWORD | MySQL password | string | - | no |
ROOT_URI | Base API url | string | - | no |
Each api response is typed strict and uses the IResponse
interface.
interface IResponse {
status: number;
message: string;
code?: number;
documentation?: string;
payload?: object;
}