Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dacr/counters
Just count things with API
https://github.com/dacr/counters
api openapi pekko pekko-http
Last synced: 3 months ago
JSON representation
Just count things with API
- Host: GitHub
- URL: https://github.com/dacr/counters
- Owner: dacr
- License: other
- Created: 2021-03-14T20:19:54.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-12T10:34:49.000Z (4 months ago)
- Last Synced: 2024-10-12T22:50:25.720Z (3 months ago)
- Topics: api, openapi, pekko, pekko-http
- Language: Scala
- Homepage:
- Size: 3.7 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ![](images/logo-base-64.png) Counters ![tests][tests-workflow] [![License][licenseImg]][licenseLink] [![][CountersImg]][CountersLnk]
Just count whatever you want. Two steps to create a counter :
1. Create a counters group
2. Create your counterIt has been deployed on [https://mapland.fr/counters][deployed].
Visit [this link](https://mapland.fr/counters/d5d6a0be-7ba7-41cc-aa37-beb7d957bfa0/count/cfcd5fa9-f4cb-4426-a2de-e2238339158e)
to increment and get access to the counter state, or check [this page](https://mapland.fr/counters/d5d6a0be-7ba7-41cc-aa37-beb7d957bfa0/state/cfcd5fa9-f4cb-4426-a2de-e2238339158e) directly get
the current counter state## curl usage example
```
BASE=http://127.0.0.1:8080
API=$BASE/apicurl -d '{"name":"test"}' -H "Content-Type: application/json" $API/group
# extract the group ID from the response
GROUP=d5d6a0be-7ba7-41cc-aa37-beb7d957bfa0curl -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-e2238339158ecurl $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 [scala-cli][scl],
this application is quite easy to start, just execute :
```
scala-cli --dep fr.janalyse::counters:1.0.6 -e 'counters.Main.main(args)'
```## 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" |[cs]: https://get-coursier.io/
[scl]: https://scala-cli.virtuslab.org/[deployed]: https://mapland.fr/counters
[akka-http]: https://doc.akka.io/docs/akka-http/current/index.html[Counters]: https://github.com/dacr/counters
[CountersImg]: https://img.shields.io/maven-central/v/fr.janalyse/counters_2.13.svg
[CountersLnk]: https://search.maven.org/#search%7Cga%7C1%7Cfr.janalyse.counters[tests-workflow]: https://github.com/dacr/counters/actions/workflows/scala.yml/badge.svg
[licenseImg]: https://img.shields.io/github/license/dacr/counters.svg
[licenseLink]: LICENSE