Giter VIP home page Giter VIP logo

kounter's Introduction

Kounter 🧮 fastify Railway

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

Docs

You need to set DETA_PROJECT_KEY environment variable to your Deta project key.

Kounter is built using Fastify.
It has a starightforward API with the following few endpoints.

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 a shields.io badge (SVG image) for your counter.
Parameters
  • key - The key of the counter to increment.
Query Parameters
  • silent - Set to true to disable incrementing the counter. Defaults to false.
  • style - Set the style of the badge. Can be one of flat, flat-square, for-the-badge, or plastic. Defaults to flat.
  • label - Set the left-hand-side text. Defaults to :key.
  • color - Set background of the right part (hex, rgb, rgba, hsl, hsla and css named colors supported). Defaults to brightgreen.
  • labelColor - Set background of the left part (hex, rgb, rgba, hsl, hsla and css named colors supported). Defaults to grey.
  • 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 :key without 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"
}

kounter's People

Contributors

dependabot[bot] avatar kerolloz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.