Skip to content

alicomert/Cron-Service-Simple-And-Fast-Nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cron Service - Node.js Simple And Fast

Welcome to the GitHub repository for Cron Service - Node.js Simple And Fast, a lightweight, efficient, and easy-to-use scheduling library for Node.js applications. This project is designed to facilitate the scheduling of asynchronous tasks, making it an essential tool for developers looking to automate operations, perform routine data fetches, send notifications, and more.

Project Overview

Cron Service - Node.js Simple And Fast provides a straightforward way to manage time-based tasks in Node.js applications. It leverages the power of asynchronous JavaScript to perform scheduled tasks without blocking the main thread, ensuring your application remains responsive.

Key Features:

  • Simple Integration: Designed with simplicity in mind, integrating this service into your Node.js project is straightforward, requiring minimal setup.

  • Lightweight Design: The service is built to be lightweight, ensuring minimal impact on your application's performance.

  • Flexible Scheduling: Offers the flexibility to schedule tasks at various intervals - from seconds to days, allowing for precise control over task execution.

  • Error Handling: Includes robust error handling mechanisms, ensuring that your scheduled tasks are reliable and your application remains stable.

  • Telegram Notifications: Features the ability to send notifications via Telegram, providing instant alerts on task failures or important events

      const telegramAPI = `https://api.telegram.org/botBOT_TOKEN_API/sendMessage`;
      sendTelegramMessage(YOUR_TELEGRAM_USER_ID, `Link problem: ${url}`);
  • Independent Scheduling: Tasks are managed independently, ensuring that the delay or failure of one task does not impact the execution of others.

  • Custom Time Windows: Supports scheduling tasks within custom time windows, allowing tasks to run only during specified hours.

Getting Started

To get started with Cron Service - Node.js Simple And Fast, clone this repository to your local machine:

git clone https://github.com/alicomert/Cron-Service-Simple-And-Fast-Nodejs.git

Navigate into the project directory and install the necessary dependencies:

cd Cron-Service-Simple-And-Fast-Nodejs
npm install

Usage

Here's a simple example to demonstrate how to schedule a task:

// Define your URLs and scheduling parameters
const urls = [
  'https://api.example.com/data',
  'https://api.example.com/notification',
];

const schedules = [
  { delay: 10000 }, // First URL: 10 seconds delay
  { start: '19:00', end: '22:00', delay: 0 }, // Second URL: Specific time window
];

// Start the task scheduling
fetchDataWithTiming(urls, schedules);

Customizing Task Scheduling

You can customize the scheduling for each task by modifying the schedules array. Each element in the array corresponds to a task, with properties to define the start time, end time, and delay.

Contributing

Contributions are welcome! Whether you're fixing a bug, adding a feature, or improving the documentation, your help is appreciated. Please feel free to fork the repository, make your changes, and submit a pull request.

License

This project is open-source and available under the MIT License. See the LICENSE file for more details.

Final Notes

Cron Service - Node.js Simple And Fast aims to provide a reliable and efficient solution for task scheduling in Node.js applications. Whether you're building a small project or a large-scale application, this service is designed to meet your scheduling needs.

For more information, visit the project on GitHub: Cron Service - Node.js Simple And Fast.

Thank you for considering Cron Service - Node.js Simple And Fast for your project. Happy coding!