Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.29 KB

README.md

File metadata and controls

60 lines (44 loc) · 1.29 KB

Description

An implementation of a rate limiter to control the rate of requests to end users based on custom rules.

The application is built with Node.js, NestJS, TypeScript, Knex and Docker.

During the development, I've tried to follow the Hexagonal Architecture, so the application is divided into some layers

Also, I've tried my best to use TDD as much as possible, so I've created a test suite with Jest

Installation

$ yarn install

Migrations

$ yarn knex migrate:latest

Seeding

$ yarn knex seed:run

This will create some rules for testing.

Type Limit Period
STATUS 3 minute
NEWS 5 minute
OTHERS 2 hour

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Running the app with docker

$ docker-compose up

⚠️ It's necessary to run the migrations in order to make the application work.

Test

# unit tests
$ yarn run test

# test coverage
$ yarn run test:cov