Skip to content
Snippets Groups Projects
Commit b19ae32e authored by Ulf Seltmann's avatar Ulf Seltmann
Browse files

updated documentation

parent 1a3572f3
Branches
Tags
No related merge requests found
# dacap
*Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough.
## Requirements
* node >= v8.2.1
* npm >= v5.3.0
## Install the service
```bash
$# npm install -g dacap
```
## Start the service
``` bash
$# dacap
```
The Admin Interface is now available under http://localhost:3000/admin
You can customize multiple values, see [#Advanced Configuration]
## Usage
First of all one has to define a *Cache* where the requests to an API-Endpoint are stored. This is done from within the Admin Interface.
One has to define the URL to the desired *API-Endpoint* (e.g. `http://foo.example.com/`) and a *Cache-Name* for this API-Endpoint (e.g. `foo`). All API-Requests which normally would go to
http://foo.example.com/?query=foo&offset=0&limit=10
now you can request by accessing
http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10
* *Be sure to append the Slash after the Cache-Name, otherwise the Endpoint cannot be resolved.*
* *Everything after the Cache-Name and Slash will be passed to the API-Endpoint.*
## Advanced Configuration
The service can be configured by environment variables. The following are available:
* `data_dir`: specifies the folder where the cache is stored in intervals. This is only used to
make it more easy to restart the service without adding all Endpoints again. After restart the
service reads the saved cache-file and keeps it in memory.
By default this points to the `data`-folder where the process was invoked. Make sure it can be created if not existing and written if already existing.
* `proxy_path`: this is the path where the Endpoints will be accessable after registering. By default this is `/ep/`
* `proxy_port`: this is the port number where the service is listening. Defaults to `3000`
* `proxy_url`: this is the absolute url of the service with protocol and port if differing from the defaults (e.g. `http://api.example.com:8080`). Set this if you use a different domain name than `localhost` to connect to this service.
* `cache_ttl`: the time-to-live in seconds of a cached request. after this time the cache will be refreshed. Defaults to `600`
* `default_check_period`: specifies the interval in seconds the cache is checked for expiry. Defaults to `60`
* `array_value_size`: unkown configuration. Defaults to `40`
* `object_value_size`: unkown configuration. Defaults to `80`
* `autosave_interval`: specifies the interval the cache is stored to harddisk. defaults to `60`;
* `register_name`: specifies the name of the register where the cache is stored. Defaults to `api-cache`;
docs/Readme.md
\ No newline at end of file
# dacap
*Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough.
## Requirements
* node >= v8.2.1
* npm >= v5.3.0
## local Execution
### Installation
```bash
$# npm install -g dacap
```
### Execution
``` bash
$# dacap
```
## as Container
```bash
$# docker run -p 3000:3000 -v /my/hosts/data/folder:/data ubleipzig/dacap
```
You can customize multiple values, see [Advanced Configuration](#Advanced Configuration)
## Usage
After Start the Admin-Interface is available under `http://localhost:3000/admin`.
First of all one has to define a *Cache* where the requests to an API-Endpoint are stored. This is done from within the Admin Interface.
One has to define the URL to the desired *API-Endpoint* (e.g. `http://foo.example.com/`) and a *Cache-Name* for this API-Endpoint (e.g. `foo`).
All API-Requests which normally would go to
`http://foo.example.com/?query=foo&offset=0&limit=10`
now you can request by accessing
`http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10`
* *Be sure to append the Slash after the Cache-Name, otherwise the Endpoint cannot be resolved.*
* *Everything after the Cache-Name and Slash will be passed to the API-Endpoint.*
## Advanced Configuration
The service can be configured by environment variables. The following are available:
* `data_dir`: Specifies the folder where the cache is stored in intervals. This is only used to
make it more easy to restart the service without adding all Endpoints again. After restart the
service reads the saved cache-file and keeps it in memory.
By default this points to the `data`-folder where the process was invoked. Make sure it can be created if not existing and written if already existing.
* `proxy_path`: Specifies the path where the Endpoints will be accessable after registering. By default this is `/ep/`.
* `proxy_port`: Specifies the port number where the service is listening. Defaults to `3000`.
* `proxy_url`: Specifies the absolute url of the service with protocol and port if differing from the defaults
(e.g. `https://api.example.com:8443/dacap`). Defaults to `http://localhost:${proxy_port}`.
* `cache_ttl`: Specifies the time-to-live in seconds of a cached request. after this time the cache will be refreshed. Defaults to `600`
* `default_check_period`: Specifies the interval in seconds the cache is checked for expiry. Defaults to `60`
* `array_value_size`: Unkown configuration. Defaults to `40`
* `object_value_size`: Unkown configuration. Defaults to `80`
* `autosave_interval`: Specifies the interval the cache is stored to harddisk. Defaults to `60`.
* `register_name`: Specifies the name of the register where the cache is stored. Defaults to `api-cache`.
* `strip_path`: Specifies whether the path should be stripped when processing requests. Defaults to `true`.
# dacap
*Dynamic And Compressing Api Proxy* is a service which lets you proxy arbitrary API-Endpoints which are by themself to slow to be used in production environments. All cached Responses are held in memory, so be sure to provide enough.
*Dynamic And Compressing Api Proxy* ist ein Dienst, der Ausgaben beliebiger API-Endpunkte zwischenspeichert. Der Dienst wurde erstellt, um API-Requests, welche durch den zur Verfügung stellenden Service nicht performant genug ausgeliefert werden können, zwischenzuspeichern und aus dem Cache auszuliefern zu können. Zusätzlich wird das Response gzip-komprimiert ausgeliefert und die Cache-Daten werden in einem eingestellten Interval im Hintergrund erneuert.
## Requirements
## Abhängigkeiten
* node >= v8.2.1
* npm >= v5.3.0
## Install the service
## lokale Ausführung
### Installation
```bash
$# npm install -g dacap
```
### Ausführung
## Start the service
``` bash
$# dacap
```
The Admin Interface is now available under http://localhost:3000/admin
## als Container
```bash
$# docker run -p 3000:3000 -v /my/hosts/data/folder:/data ubleipzig/dacap
```
Die Konfiguration wird über Umgebungsvariablen durchgeführt, siehe [erweiterte Konfiguration](#erweiterte Konfiguration)
## Benutzung
Nach dem Start ist das Admin-Interface unter `http://localhost:3000/admin` verfügbar
You can customize multiple values, see [#Advanced Configuration]
Als erstes wird ein *Cache* definiert, in dem die Ergebnisse der Anfragen an einen API-Endpunkt gespeichert werden.
## Usage
Unter *API-Endpoint* wird die URL eingetragen, die zum Service führt (z.B. `http://foo.example.com/`),Unter *Cache-Name* wird eine Bezeichnung für den Service eingetragen, (z.B. `foo`).
First of all one has to define a *Cache* where the requests to an API-Endpoint are stored. This is done from within the Admin Interface.
Alle Anfragen, die normalerweise an
One has to define the URL to the desired *API-Endpoint* (e.g. `http://foo.example.com/`) and a *Cache-Name* for this API-Endpoint (e.g. `foo`). All API-Requests which normally would go to
`http://foo.example.com/?query=foo&offset=0&limit=10`
http://foo.example.com/?query=foo&offset=0&limit=10
gehen würden, können nun unter
now you can request by accessing
`http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10`
http://localhost:3000/ep/foo/?query=foo&offset=0&limit=10
abgefragt werden.
* *Be sure to append the Slash after the Cache-Name, otherwise the Endpoint cannot be resolved.*
* *Everything after the Cache-Name and Slash will be passed to the API-Endpoint.*
* *nach dem Cache-Name ist zwingend ein Slash erforderlich, andernfalls kann der Endpunkt nicht aufgelöst werden.*
* *alles, was nach Cache-Name und Slash folgt, wird an den API-Endpunkt angehängt.*
## Advanced Configuration
## Erweiterte Konfiguration
The service can be configured by environment variables. The following are available:
Der Dienst lässt sich über Umgebungsvariablen konfigurieren, die beim Start des Dienstes ausgewertet werden:
* `data_dir`: specifies the folder where the cache is stored in intervals. This is only used to
make it more easy to restart the service without adding all Endpoints again. After restart the
service reads the saved cache-file and keeps it in memory.
By default this points to the `data`-folder where the process was invoked. Make sure it can be created if not existing and written if already existing.
* `proxy_path`: this is the path where the Endpoints will be accessable after registering. By default this is `/ep/`
* `proxy_port`: this is the port number where the service is listening. Defaults to `3000`
* `proxy_url`: this is the absolute url of the service with protocol and port if differing from the defaults (e.g. `http://api.example.com:8080`). Set this if you use a different domain name than `localhost` to connect to this service.
* `cache_ttl`: the time-to-live in seconds of a cached request. after this time the cache will be refreshed. Defaults to `600`
* `default_check_period`: specifies the interval in seconds the cache is checked for expiry. Defaults to `60`
* `array_value_size`: unkown configuration. Defaults to `40`
* `object_value_size`: unkown configuration. Defaults to `80`
* `autosave_interval`: specifies the interval the cache is stored to harddisk. defaults to `60`
* `register_name`: specifies the name of the register where the cache is stored. Defaults to `api-cache`
* `strip_path`: specifies whether the path should be stripped when processing requests
* `data_dir`: Spezifiziert den Ordner, wo der Cache in regelmäßigen Abständen gespeichert wird.
Cache und Endpunkte werden im Arbeitspeicher gehalten. Nach dem Neustart des Dienstes wird die Datei ausgelesen
und vorhandene Endpunkte und Caches in den Arbeitspeicher geladen.
Standardmäßig ist dieser Ordner der `data`-Ordner in dem Ordner, aus dem der Prozess gestartet wurde (Im Container der Root-Ordner)
Es ist sicherzustellen, dass der erstellt werden kann oder für den Dienst schreibbar ist, wenn er bereits existiert.
* `proxy_path`: Spezifiziert den Pfad an dem der Endpunkt nach der Registrierung mit seinem Cache-Namen erreichbar ist.
Standardmäßig `/ep/`.
* `proxy_port`: Spezifiziert den Port, an dem der Dienst hört. Standardmäßig `3000`
* `proxy_url`: Spezifiziert die absolute URL des Dienstes mit Protokoll-Schema, Port und Pfad (z.B. `https://api.example.com:8443/dacap`)
Standardmäßig `http://localhost:${proxy_port}`.
* `cache_ttl`: Spezifiziert die time-to-live in Sekunden für ein Cache-Ergebnis. Nach dieser Zeit wird das
Ergebnis erneuert. Standardmäßig `600`.
* `default_check_period`: spezifiziert das Intervall in Sekunden, in dem die Ablauf-Frist aller Cache-Ergebnisse geprüft wird.
Standardmäßig `60`.
* `array_value_size`: Unbekannte Konfiguration. Defaults to `40`
* `object_value_size`: Unbekannte Konfiguration. Defaults to `80`
* `autosave_interval`: Spezifiziert das Intervall, in dem alle Cache-Ergebnisse und Endpunkt-Konfiguration in eine Datei
geschrieben werden. Standardmäßig `60`.
* `register_name`: Spezifiziert den Namen des Registers, in dem alle Cache-Ergebnisse und Endpunkt-Konfigurationen
gespeichert werden (ist gleichzeitig der Dateiname). Standardmäßig `api-cache`.
* `strip_path`: Spezifiziert, ob der Pfad der Url entfernt werden soll. Standardmäßig `true`.
site_name: dacap
pages:
- Deutsch: "index.md"
- English: "Readme.md"
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment