Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cvan/rapidorapido
¡An experiment in front-end HTTP(S) proxying+caching! ¡Rapido! ¡Rapido!
https://github.com/cvan/rapidorapido
Last synced: 2 days ago
JSON representation
¡An experiment in front-end HTTP(S) proxying+caching! ¡Rapido! ¡Rapido!
- Host: GitHub
- URL: https://github.com/cvan/rapidorapido
- Owner: cvan
- Created: 2013-12-04T07:50:37.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-05T00:01:39.000Z (about 11 years ago)
- Last Synced: 2025-01-29T18:02:42.363Z (9 days ago)
- Language: JavaScript
- Size: 168 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rápidorápido
¡An experiment in front-end HTTP(S) proxying+caching! ¡Rapido! ¡Rapido!
## Installation
1. Install `rapidorapido` from npm:
```
npm install rapidorapido
```Or if installing from master via GitHub:
```
git clone https://github.com/cvan/rapidorapido.git
cd rapidorapido
npm install
```2. Then create and edit your settings file:
```
cp settings.json.dist settings.json
```## Usage
rapidorapido [options]
## Options
-h, --help Output usage information
-p, --port Port to listen on## Requirements
* redis (via [homebrew](http://brew.sh/))
```
brew install redis
```* node
```
curl https://npmjs.org/install.sh | sh
```## How it works
### Sample `settings.json`
```json
{
"host": "http://api.yolo.com",
"expire": "60",
"methods": ["GET", "OPTIONS"],
"refreshAsync": "true"
}
```
host
- the URL of your host
-
expire
(optional) - the time to live (TTL) for the response in redis;
if omitted, responses will be cached without expiry -
methods
(optional) - the allowed methods for proxying and caching;
if omitted, allowed methods will be["GET", "HEAD", "OPTIONS"]
-
refreshAsync
(optional) - boolean for whether to asynchronously make the request to
the host and cache its response even after a cache hit;
if omitted, this will default totrue
### Sample usage
If you have an endpoint at http://api.yolo.com/api/v1/search then request
http://localhost:8080/api/v1/search
Upon the first time anyone accesses this URL, the request will be proxied and its response is then cached (in redis) for 60 seconds (the TTL/`expire`).
The responses for any subsequent requests (until 60 seconds has elapsed) will be retrieved from the cache and delivered immediately; asynchronously the cache is refreshed (if the content has changed) with that URL's response set to expire again in 60 seconds.