Get the requested page's views or unique visitors from Plausible Analytics
Sangelo
f5ce64f31f
Some checks failed
Build and Push Docker Image / docker-build (push) Failing after 1s
|
||
---|---|---|
.forgejo/workflows | ||
.env.example | ||
.gitignore | ||
Dockerfile | ||
main.js | ||
package.json | ||
README.md | ||
yarn.lock |
plausible-pageviews-api
Get the requested page's views or unique visitors from Plausible Analytics.
Configuration in .env
PORT=3000 # the api port
METRICS_PORT=9100 # the port on which prometheus metrics are hosted on, endpoint: /metrics
PLAUSIBLE_DOMAIN=plausible.io # the plausible instance domain
PLAUSIBLE_API_KEY="api_key_goes_here" # your plausible API key
ALLOWED_ORIGINS="https://example.com" # allowed CORS origins
RATE_LIMIT_MINUTES=15 # the amount of time in minutes to rate limit
RATE_LIMIT_REQUESTS=100 # amount of max. requests
Don't change the PORT
value when running in a Docker Container. Instead, export a different port and forward that to the container's port 3000
.
# example for docker-compose.yml:
ports:
- "5678:3000"
You also have to mount the .env
file inside the container, if you're using Docker:
volumes:
- .env:/app/.env
Run the API
$ yarn install
$ yarn start