change path to /clicks for all calls
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
98477d8437
commit
a324047cd7
|
@ -4,8 +4,9 @@ This is a minimal API done using Koa and Redis for counting clicks.
|
|||
|
||||
It exposes just 2 calls:
|
||||
|
||||
* `PUT /click` - Increments the counter by 1 and returns current count.
|
||||
* `GET /clicks` - Returns the JSON with clicks count.
|
||||
* `PUT /clicks/:id` - Bumps the counter by 1 and returns current count for ID.
|
||||
* `GET /clicks/:id` - Returns the JSON with clicks count for the ID.
|
||||
* `GET /clicks` - Returns the JSON with all the clicks counts.
|
||||
|
||||
# Requirements
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const router = new Router()
|
|||
const redis = Redis.createClient(REDIS_PORT, REDIS_HOST)
|
||||
const counter = new Counter(redis)
|
||||
|
||||
router.put('/click/:id', async ctx => {
|
||||
router.put('/clicks/:id', async ctx => {
|
||||
counter.incr(ctx.params.id)
|
||||
ctx.body = { [ctx.params.id]: await counter.state(ctx.params.id) }
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue