Skip to content

A set of Node.js API tested via Artillery and protected with rate limiters

Notifications You must be signed in to change notification settings

wilk/api-artillery-test

Repository files navigation

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

About

A set of Node.js API tested via Artillery and protected with rate limiters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published