Code Monkey home page Code Monkey logo

punjabinuclei / cp-calendar-backend Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 25 KB

This Node.js Express application serves as a backend for fetching and caching contest data from a third-party API. The fetched data is stored in a Redis cache, and the backend offers an efficient way to retrieve this data through API requests while minimizing the load on the external API.

Home Page: https://upset-ruby-butterfly.cyclic.app/

JavaScript 100.00%
api backend-api cron-job cronjob cyclic-deployment express expressjs nodejs redis

cp-calendar-backend's Introduction

Backend

Contest Data Backend

This Node.js Express application serves as a backend for fetching and caching contest data from a third-party API. The fetched data is stored in a Redis cache, and the backend offers an efficient way to retrieve this data through API requests while minimizing the load on the external API.

Features

  • Data Caching: The application fetches fresh contest data from the Clist API and stores it in a Redis cache. This helps reduce the number of requests made to the external API and enhances response times.
  • Scheduled Data Refresh: A cron job is set up to periodically refresh the contest data at fixed intervals (every 30 minutes by default). This ensures that the cached data remains up-to-date with the latest information from the external API.
  • Middleware for Cache Check: A middleware is implemented to check the Redis cache before making a request to the external API. If the requested data is available in the cache, it is served directly, minimizing the need to make repeated calls to the external API.

Prerequisites

Before running the application, make sure you have the following:

  • Node.js installed
  • Redis server running locally or on a remote server
  • API key for the Clist API

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/contest-data-backend.git
    cd contest-data-backend
    
  2. Install dependencies:

    npm install
    
  3. Create a .env file in the project root and provide the necessary environment variables:

    CLIST_API_USERNAME=your_username
    CLIST_API_KEY=your_key
    PORT=3000
    
    

Usage

  1. Run the application:

    npm start
    

    The server will start on the specified port (default is 3000).

  2. Access the API:

    The API endpoint is http://localhost:3000. You can make GET requests to this endpoint to retrieve contest data. The middleware will check the Redis cache before fetching fresh data from the Clist API.

Contributing

Feel free to contribute to the development of this project by opening issues or submitting pull requests. Make sure to follow the contributing guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Thank you for using and contributing to the Contest Data Backend!

cp-calendar-backend's People

Contributors

punjabinuclei avatar

Stargazers

Sakshi avatar Divyansh Anand avatar diku agarwal 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.