Skip to content

denisulit/redis-http-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis HTTP Queue

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.

Features

  • 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

Prerequisites

  • Node.js
  • pnpm
  • Redis

Installation

  1. Clone the repository:

    git clone https://github.com/denisulit/redis-http-queue
    cd redis-http-queue
  2. Install dependencies:

    pnpm install
  3. Create a .env file 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

Running the Project

  1. Compile the TypeScript code:

    pnpm exec tsc
  2. Start the server:

    node dist/index.js

API Endpoints

Add to Queue

  • 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 queue
    • 400 Bad Request: Missing required fields
    • 401 Unauthorized: Incorrect password

Contributing

Feel free to submit issues or pull requests if you have any improvements or fixes.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published