Skip to content

example rest api using express on typescript using token bucket algorithm

Notifications You must be signed in to change notification settings

huzairuje/express-typescript-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e20291e · Nov 12, 2024

History

1 Commit
Nov 12, 2024
Nov 12, 2024
Nov 12, 2024
Nov 12, 2024
Nov 12, 2024
Nov 12, 2024
Nov 12, 2024

Repository files navigation

README

Description

this repository basically implementing limiter rate (Token Bucket Algorithm) and cache (CQRS pattern) on typescript using expressjs http framework (https://expressjs.com/), postgresql and redis.

Install PreRequisite

  1. run npm start to install or up or run the postgres container and redis container.
  2. make sure the docker postgres or container postgres is running and make database on the postgres container with name test_cache_cqrs and run the sql script on the directory migrations
  3. make sure redis container is up and running
  4. make sure the config on config.local.yaml is correct

How to Run Locally

npm start

Endpoint URL

  1. GET localhost:1234/api/v1/tasks?page=0&size=1&query=place get list article curl
curl --location 'localhost:1234/api/v1/tasks?page=0&size=1&query=place'
  1. GET localhost:1234/api/v1/articles/12 Get Detail Article curl
curl --location 'localhost:1234/api/v1/tasks/12'
  1. POST localhost:1234/api/v1/tasks create article curl
curl --location 'localhost:1234/api/v1/tasks' \
--header 'Content-Type: application/json' \
--data '{
    "author": "radiohead",
    "title": "jigsaw falling into place",
    "body": "<div>Just as you take my hand<br>Just as you write my number down<br>Just as the drinks arrive<br>Just as they play your favourite song<br>As your bad day disappears<br>No longer wound up like a spring<br>Before you'\''ve had too much<br>Come back in focus again<br>"
}'

About

example rest api using express on typescript using token bucket algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published