8000 GitHub - RoghanBehm/caching-proxy
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

RoghanBehm/caching-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caching Proxy Server

A lightweight, configurable proxy server which forwards requests to a target API (by default, https://jsonplaceholder.typicode.com), caches GET responses locally, and serves cached responses when available to reduce redundant external API calls.

Usage

npm run dev -- --port 4000 --origin https://example.com --clear-cache

Available Flags

Flag Description Example
--port Port for the proxy server to listen on (default: 3000) --port 4000
--origin The base URL to which requests will be forwarded --origin https://example.com
--clear-cache Clears the local response cache at startup --clear-cache

Cache

Cached responses are stored as .json files in the cache/ directory. Responses are hashed by URL for uniqueness.

Example

Cached (GET)

curl http://localhost:3000/posts/1
  • First request fetches from origin and caches response before serving.
  • Subsequent identical requests are served from the cache.

Not Cached (POST)

curl -X POST http://localhost:3000/posts -H "Content-Type: application/json" -d '{"title": "hey guys"}'
  • Request is forwarded to the origin API but not cached.
  • Only GET responses are stored in the local cache.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0