An easy-to-integrate like counter for your website.
Note
Try demo here. Also look at the singling views-counter
API of the app is available at address: https://lc.somespecial.one.
But please, if you tend to use it heavily, consider to installing the app on Deta Space
by yourself with button above!
App exposes json API routes.
Generate unique user id, if you don't want ot make it by yourself on client side.
Have len
query param - length of generated id. Default len
value is 10.
GET
/generate
{
"id": "generated id"
}
slug
- unique key for page/post/etc.userId
- unique user id. Can be generated in/generate
route.
GET
:slug/:userId
{
"userLikes": 0,
"totalLikes": 0
}
POST
:slug/:userId
Payload (body) must be JSON and contain count
field. For example:
{
"count": 1
}
Response is null
By default, the maximum number of the likes is limited to 1.
To set your own option you can add ::{your max likes number}
postfix to slug
.
For example super-unique-slug::10
will set max number to 10 for the current route.
App can use NITRO_DEF_MAX_LIKES_COUNT
env variable to set default number, know more
You can install app on Deta Space
with button above.
If this is not an option for you, application code can be built for these providers, so just clone the repo and use your provider.
App use Deta Base
for database, so DETA_PROJECT_KEY
or NITRO_DETA_PROJECT_KEY
are required.
DETA_PROJECT_KEY
/NITRO_DETA_PROJECT_KEY
- deta project key, required if app installed not inDeta Space
. Read more thereNITRO_DEF_MAX_LIKES_COUNT
- max number of likes. Default 1NITRO_DEF_ID_LENGTH
- length of generated id. Default 10NITRO_ALLOW_ORIGIN
- allow origin header. Default *
Clone repo and run test
script with your package manager or
vitest