https://github.com/lunarwhisperrrr/throttle-maker
A TypeScript-based throttler implementation for Express.js, designed to manage and limit incoming HTTP requests. This project showcases a non-blocking, asynchronous approach to queue and process requests while adhering to specified rate limits.
https://github.com/lunarwhisperrrr/throttle-maker
event-loop expressjs typescript
Last synced: 12 months ago
JSON representation
A TypeScript-based throttler implementation for Express.js, designed to manage and limit incoming HTTP requests. This project showcases a non-blocking, asynchronous approach to queue and process requests while adhering to specified rate limits.
- Host: GitHub
- URL: https://github.com/lunarwhisperrrr/throttle-maker
- Owner: lunarwhisperrrr
- Created: 2025-01-27T19:20:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-28T05:42:55.000Z (about 1 year ago)
- Last Synced: 2025-01-28T06:27:39.665Z (about 1 year ago)
- Topics: event-loop, expressjs, typescript
- Language: TypeScript
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Throttle Maker in TypeScript with Express.js
## Overview
This repository contains a simple implementation of a throttler (rate limiter) built using TypeScript and Express.js. The throttler is designed to manage the rate of incoming requests to HTTP endpoints, ensuring they adhere to predefined limits. This project serves as a proof of concept for testing throttling mechanisms in a Node.js environment without blocking the event loop.
## Features
- Rate Limiting: Control the maximum number of requests that can be processed over a specified time interval.
- Queue Management: Incoming requests are queued and processed as capacity allows, avoiding overload and ensuring smooth operation.
- Asynchronous Handling: Utilizes asynchronous techniques for non-blocking request processing.
- Customizable Limits: Easily adjust the number of allowed requests and the time window for throttling.
## Tech Stack
- TypeScript: For type safety and improved developer experience.
- Express.js: Web framework for building APIs.
- Node.js: JavaScript runtime for executing server-side code.
## Getting Started
To run this project, follow these steps:
Clone the Repository
```bash
git clone https://github.com/yourusername/throttle-maker.git
cd throttle-maker
Install Dependencies
```
```bash
npm install
Run the Application
```
```bash
npm start
```
## Test the Endpoints
You can test the throttled endpoints using a tool like Postman or curl.
Example Requests:
To trigger the process1 endpoint:
```bash
curl -X POST http://localhost:3000/process1
```
To trigger the process2 endpoint:
```bash
curl -X POST http://localhost:3000/process2
```
## License
This project is licensed under the MIT License - see the LICENSE file for details