Skip to content

Latest commit

 

History

History
77 lines (48 loc) · 1014 Bytes

README.md

File metadata and controls

77 lines (48 loc) · 1014 Bytes

API

Requirements

  • PNPM
  • NVM

Align Node.js

$ nvm use

Install deps

$ pnpm i

Prepare the dbs

Schema

Local & test db:

$ pnpm db:migrate

This will produce two database files in the data folder: one for the local development and another one for testing

Seed

$ pnpm db:seed

Generate auth tokens

$ pnpm generate-tokens

Inside the artillery/api-load.yml file, replace REPLACE_ME_WITH_A_REAL_TOKEN with one of the generated tokens.

Prepare env vars

$ cp .env.sample .env

Then replace JWT_SECRET with a real one.

Testing

$ pnpm test

Testing via Artillery

Test the API via artillery:

$ pnpm start # first run the server
$ pnpm test:api:load # second run the load-test

The config file is: artillery/api-load.yml

API Rate Limiting

The API are limited using express-rate-limit

API Rate Slow Down

The API are time-limited using express-slow-down