This project is a basic queuing system using Redis, TypeScript, and Express. It allows you to add tasks to a queue and process them asynchronously.
Warning: This won't be kept up to date and I am just publishing this for a project I am making.
- Add tasks to the queue via an API endpoint
- Process queued tasks using Axios for HTTP requests
- Use environment variables for configuration
- Strongly-typed environment variables using Zod
- Node.js
- pnpm
- Redis
-
Clone the repository:
git clone https://github.com/denisulit/redis-http-queue cd redis-http-queue -
Install dependencies:
pnpm install
-
Create a
.envfile in the root of the project and add the following:REDIS_URL=redis://localhost:6379 QUEUE_PASSWORD=your_password_here PORT=3000 QUEUE_TIMEOUT=30000 REQUEUE_DELAY=30000
-
Compile the TypeScript code:
pnpm exec tsc -
Start the server:
node dist/index.js
-
URL:
/queue -
Method:
POST -
Body:
{ "id": "unique_task_id", "url": "http://example.com/api", "options": { "method": "GET", "headers": { "Authorization": "Bearer token" } }, "password": "your_password_here" } -
Responses:
200 OK: Task added to queue400 Bad Request: Missing required fields401 Unauthorized: Incorrect password
Feel free to submit issues or pull requests if you have any improvements or fixes.
This project is licensed under the MIT License.