change path to /clicks for all calls

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-11-14 16:25:25 +01:00
parent 98477d8437
commit a324047cd7
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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) }
});