Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Kounter is a tiny webservice that works as a counter 🧮

NotificationsYou must be signed in to change notification settings

kerolloz/kounter

Repository files navigation

Kounter is a simple counter service that can be used in various ways.
Use cases include a profile views counter, repository visits counter, or anything you want to count.

Development

For development, you must set theDETA_PROJECT_KEY environment variable to your Deta project key.
This project usesBun for development.

bun dev

Docs

Kounter is built usingFastify.
It has a straightforward API with the following few endpoints.

Note

You can also check the SwaggerAPI documentation for more details.

Endpoints

Base URL:https://kounter.kerolloz.dev

GET/

Redirects to this repository.


GET/badge/:key

  • Increments the counter by 1 if:key exits; creates a new counter with count initialized to 1 otherwise.
  • Returns ashields.io badge (SVG image) for your counter.
Parameters
  • key - The key of the counter to increment.
Query Parameters
  • silent - Set totrue todisable incrementing the counter. Defaults tofalse.
  • style - Set the style of the badge. Can be one offlat,flat-square,for-the-badge, orplastic. Defaults toflat.
  • label - Set the left-hand-side text. Defaults to:key.
  • color - Set the background of the right part (hex, rgb, rgba, hsl, hsla and css named colors supported). Defaults tobrightgreen.
  • labelColor - Set the background of the left part (hex, rgb, rgba, hsl, hsla and css named colors supported). Defaults togrey.
  • cntPrefix - Set prefix to display before the counter value. Defaults to"" empty string.
  • cntSuffix - Set suffix to display after the counter value. Defaults to"" empty string.
Examples

![badge](https://kounter.kerolloz.dev/badge/kerolloz.kounter)
badge

![badge](https://kounter.kerolloz.dev/badge/kerolloz.kounter?style=flat-square&color=blue&silent=true)
badge

![badge](https://kounter.kerolloz.dev/badge/kerolloz.kounter?label=kerolloz/kounter&labelColor=white&cntPrefix=visits%20&silent=true)
badge

![badge](https://kounter.kerolloz.dev/badge/kerolloz.kounter?label=&color=333&style=for-the-badge&cntSuffix=%20Views&silent=true)
badge


GET/count/:key

Try it
  • Returns the current count for:keywithout incrementing it.
  • Returns{ key: ":key", count: 0 } if the counter:key does not exist.
Parameters
  • key - The key of the counter to get count value for.
Example
$ curl -X GET https://kounter.kerolloz.dev/count/xyz{"count": 1,"key":"xyz"}

[8]ページ先頭

©2009-2025 Movatter.jp