Giter Club home page Giter Club logo

task-scheduler's Introduction

task-scheduler

An API service used to schedule cron jobs targetting to external APIs

What?

Say you want to fetch some data at regular intervals into your project and this data is to be fetched from external APIs, use this application to create/schedule cron jobs and save data to ur database (i used mongo here)

How does it work

classDiagram
    class apiSchema {
        _id: ObjectId
        appId: ObjectId
        apiName: String
        apiRoute: String
        requestType: String
        queryParams: Mixed
        headerParams: Mixed
        payload: Mixed
        isActive: Boolean
        frequency: String
        triggerTime: Date
        cronExpression: String
        history: Array
        createdAt: Date
        appName: String
        description: String
        rootPath: String
    }

    class applicationSchema {
        _id: ObjectId
        appName: String
        description: String
        rootPath: String
        apiList: Array
        auth: Object
    }

    apiSchema *-- applicationSchema : appId

Loading
  • 2 schemas Application and API where we store application and api data respectively
  • Each application contains a list of APIs which are cron jobs to be targetted
  • 2 ways to run the jobs, Automatic or Manual. frequency field in APIs help us differentiate this. If 'Instant', its manual else the later
  • If the server restarts, we'll pick up from where we left off by checking the isActive status

How to run

  1. npm i
  2. npm run dev: for running locally (nodemon enabled)
  3. npm start for production

Secrets

  1. Create a .env file at the root and initialize all variables you'll need from config.js
  2. Example securityKey: process.env.NODE_APP_SECURITY_KEY you will make an entry in .env called NODE_APP_SECURITY_KEY: XYZ

Contributions

  • Be nice, create a PR and I'll review them

task-scheduler's People

Contributors

aasitvora99 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.