Giter Club home page Giter Club logo

mrpgmr67 / api-proxy-server Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 87 KB

The API Proxy Server is a project providing a local server for making requests to external APIs with additional features like caching, logging, and authentication. It's built to handle GET requests and includes rate limiting. The project is licensed under the MIT license, making it free to use, modify, and distribute.

Home Page: https://www.pomatto.com

License: GNU General Public License v3.0

JavaScript 67.47% HTML 12.97% CSS 19.56%
api http-proxy proxy

api-proxy-server's Introduction

API Proxy Server

This project is an API proxy server based on a design by Travesy Media, that enables users to make requests to an external API through a local server. By routing requests through the proxy server, users can add additional functionality, such as caching, logging, and authentication, without modifying the client application.

Features

  • Proxy requests to an external API
  • Caching of responses to improve performance
  • Logging of request and response data for debugging
  • Authentication of requests using API keys or OAuth 2.0 tokens
  • Rate limiting to prevent abuse and ensure fair usage

Getting Started

To use the API proxy server, you will need to have Node.js and npm installed on your local machine. Once you have these dependencies installed, follow these steps:

  1. Clone the repository to your local machine.
  2. Install the required packages by running npm install.
  3. Create a .env file in the root directory of the project with the following variables:
  4. API_BASE_URL: the base URL of the external API you wish to proxy
  5. API_KEY: the API key required for authentication (if applicable)
  6. OAUTH_CLIENT_ID: the client ID required for OAuth 2.0 authentication (if applicable)
  7. OAUTH_CLIENT_SECRET: the client secret required for OAuth 2.0 authentication (if applicable)
  8. Start the server by running npm start.

Usage

To make requests through the API proxy server, use the URL of the local server (http://localhost:3000 by default) as the base URL for your requests. All requests to the local server will be proxied to the external API with the appropriate headers and parameters.

Caching

By default, the API proxy server will cache responses to GET requests to improve performance. Cached responses will be stored in memory and will expire after a set time period (30 seconds by default). To disable caching, set the DISABLE_CACHE environment variable to true.

Logging

The API proxy server will log request and response data to the console by default. To disable logging, set the DISABLE_LOGGING environment variable to true.

Authentication

If the external API requires authentication, you can include the API key or OAuth 2.0 token in the request headers. The API proxy server will automatically add the required headers to proxied requests. If authentication is not required, simply omit the API_KEY, OAUTH_CLIENT_ID, and OAUTH_CLIENT_SECRET environment variables.

Rate Limiting

To prevent abuse and ensure fair usage, the API proxy server includes rate limiting functionality. By default, requests are limited to 100 requests per minute per IP address. To customize the rate limiting behavior, modify the RATE_LIMIT_WINDOW_MS and RATE_LIMIT_MAX_REQUESTS environment variables.

Contributing

Contributions to this project are welcome! If you find a bug or have an idea for a new feature, please create a new issue or submit a pull request with your changes.

This project is licensed under the MIT license, which allows for free use, modification, and distribution of the software. See the LICENSE file for more details.

api-proxy-server's People

Contributors

dependabot[bot] avatar mrpgmr67 avatar snyk-bot avatar

Watchers

 avatar  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.