Skip to content

dacr/counters

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Counters tests License

Just count whatever you want. Two steps to create a counter :

  1. Create a counters group
  2. Create your counter

It has been deployed on https://mapland.fr/counters. Visit this link to increment and get access to the counter state, or check this page directly get the current counter state

curl usage example

BASE=http://127.0.0.1:8080
API=$BASE/api

curl -d '{"name":"test"}' -H "Content-Type: application/json" $API/group
# extract the group ID from the response
GROUP=d5d6a0be-7ba7-41cc-aa37-beb7d957bfa0

curl -d '{"name":"counter#1"}' -H "Content-Type: application/json" $API/group/$GROUP/counter
# extract the counter ID from the response
COUNTER=cfcd5fa9-f4cb-4426-a2de-e2238339158e

curl $API/group/$GROUP/counter/$COUNTER

curl $API/increment/$GROUP/$COUNTER

curl $BASE/$GROUP/count/$COUNTER

curl $BASE/$GROUP/state/$COUNTER

Quick local start

Thanks to coursier from @alxarchambault, this application is quite easy to start, just execute :

cs launch fr.janalyse::counters:0.1.0

Configuration

Environment variable Description default value
COUNTERS_LISTEN_IP Listening network interface "0.0.0.0"
COUNTERS_LISTEN_PORT Listening port 8080
COUNTERS_PREFIX Add a prefix to all defined routes ""
COUNTERS_URL How this service is known from outside "http://127.0.0.1:8080"
COUNTERS_STORE_PATH Where data is stored "/tmp/counters-data"

About

Just count

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE-ADDON

Stars

Watchers

Forks

Packages

No packages published