Skip to content

A simple queue system based in Cloudflare Workers

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT
Notifications You must be signed in to change notification settings

EmanuelJr/worker-queue

Worker Queue

⚠️⚠️ It's just a PoC made in a few hours, there is a lot of optimizations to be done and refactoring to be really usable ⚠️⚠️

Basic use

  1. Generate an authorization basic token following the authorization guide
  2. Add some element in the queue using the put endpoint
  3. Get the queue elements with get endpoint

Setup

There are some configurations to be done in the worker:

Environment variables

  • TTL - Time to the element in the queue live
  • PASSWORD - Global user password

Worker KV

A Worker KV labeled as QUEUE.

Authorization

Authorization is made through the basic authorization method, where the user can be any username and the password is the PASSSWORD enviroment variable.

Endpoints

Get next element

Endpoint: /queue/{queue name}

HTTP method: GET

Headers:

  • Authorization: Basic authorization token

Response:

{
  "index": "202110302133649351abaa14edfb4b72a54ca8ac305047ea",
  "data": "Test"
}

Push an element

Endpoint: /queue/{queue name}

HTTP method: PUT

Headers:

  • Authorization: Basic authorization token

Body: Any data JSON encoded

Response:

{
  "status": "ok"
}

About

A simple queue system based in Cloudflare Workers

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published