A plugin to harness the power of Cronyx's script-based task scheduling in your Elysia applications.
Integrate Cronyx directly with Elysia applications and enable a world of seamless task scheduling.
Install the Cronyx and ElysiaCronyx plugin using bun
:
$ bun add cronyx elysia-cronyx
For integration with the Elysia web framework:
// MysqlJobStore, PostgresJobStore and RedisJobStore are also available for the integration
import { MongodbJobStore } from "cronyx";
import cronyx from "cronyx-server";
import Elysia from "elysia";
const jobStore = await MongodbJobStore.connect("mongodb://mongo:27017/db");
const app = new Elysia().use(cronyx({ jobStore })).listen(3000);
console.log(`CronyxServer is running at ${app.server?.hostname}:${app.server?.port}`);
jobStore
: BaseJobStore - Cronyx's job store instance.timezone?
(optional): string - Defaults to local timezone if not provided.
Using Visual Studio Code and the Dev Containers extension, you can simplify the development environment setup process. The extension allows you to develop inside a Docker container and automatically sets up the development environment for you.
-
Install the Dev Containers extension in Visual Studio Code.
-
Clone the repository:
git clone https://github.com/yujiosaka/ElysiaCronyx.git
-
Open the cloned repository in Visual Studio Code.
-
When prompted by Visual Studio Code, click "Reopen in Container" to open the project inside the Docker container.
-
The extension will build the Docker container and set up the development environment for you. This may take a few minutes.
-
Build and run the Docker container with Docker Compose:
$ docker-compose up --build
This will start testing in watch mode.
Job status changes are logged via the debug module under the cronyx:elysia
namespace.
env DEBUG="cronyx:elysia" bun server.js
This project is licensed under the MIT License. See LICENSE for details.