News for hackers. Stuff that matters.
Re:Show HN: A simple web app to create a custom counter, sha... by sndk on Sunday January 24, 2021 @09:01AM (#25892076)
Hey HN! This is a simple web app to create custom counters. You can display the counter on any device which has access to the web and you can update the counter value using UI or programmatically with a HTTP GET request. The counter can be used for anything you imagine, as long as it's a number - e.g. the number of pushups you have done this year, the number of days you have worked remotely, the current value of your investment portfolio. Hopefully you will find it useful! All feedback and ideas are welcome!
Re:Show HN: A simple web app to create a custom counter, sha... by aabbcc1241 on Sunday January 24, 2021 @10:27AM (#25892780)
What is the reason to accept update request using GET method instead of POST?
Re:Show HN: A simple web app to create a custom counter, sha... by sndk on Sunday January 24, 2021 @12:44PM (#25893941)
Just trying to make it easier to use. Crafting a POST request has some overhead with setting the body etc. While with GET you could just trigger an update from browser URL bar.
Re:Show HN: A simple web app to create a custom counter, sha... by parisianka on Sunday January 24, 2021 @09:55AM (#25892497)
Nice, but where it stores the data?
Re:Show HN: A simple web app to create a custom counter, sha... by sndk on Sunday January 24, 2021 @10:03AM (#25892586)
Thanks! In a central database. It does not save your historical data, only the latest updated counter value.
Re:Show HN: A simple web app to create a custom counter, sha... by parisianka on Sunday January 24, 2021 @10:32AM (#25892820)
Some time ago I was looking something like this, really. And how can I count clicks on a button with HTML/JS, is it OK?:

<button><a href="https://counting.world/api/set/value?name=My counter&secret=MYSECRET&value=1">PRESS ME</a></button>

Re:Show HN: A simple web app to create a custom counter, sha... by sndk on Sunday January 24, 2021 @01:06PM (#25894146)
Your example would always set the counter to 1 and not increment it. From what I understood you would like to set the counter to "current value" + 1. Unfortunately there is no API at the moment to retrieve the current value. Task for the next version. Thanks for the idea!

As a side note this would also trigger a navigation away from your site not something you probably want. You should be doing this behind the scenes with JS.

You could look into https://countapi.xyz/. You won't get the displaying part but there's an API for your use case.

Re:Show HN: A simple web app to create a custom counter, sha... by parisianka on Sunday January 24, 2021 @01:22PM (#25894303)
Thanks! Exactly, "current value" + 1 is a "must have"