MInimal API for counting clicks
Go to file
dependabot[bot] 8304c48a87
Bump minimist from 1.2.5 to 1.2.6 (#9)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-28 08:59:35 +02:00
src allow up to 6 characters in ID to allow for official:fdroid 2021-03-15 12:33:45 +01:00
test update test dependencies, add more tests 2020-10-27 10:03:57 +01:00
.babelrc drop unused packages and stage-2 2018-10-17 10:08:25 -04:00
.gitignore add building of counter app with gulp 2018-10-16 16:04:08 -04:00
Dockerfile upgrade Docker image to use node:14-alpine 2020-10-27 10:03:58 +01:00
README.md change path to /clicks for all calls 2018-11-14 16:25:25 +01:00
gulpfile.js upgrade Gulp from 3.9.1 to 4.0.2 2020-10-27 10:03:56 +01:00
package.json update test dependencies, add more tests 2020-10-27 10:03:57 +01:00
yarn.lock Bump minimist from 1.2.5 to 1.2.6 (#9) 2022-03-28 08:59:35 +02:00

README.md

Description

This is a minimal API done using Koa and Redis for counting clicks.

It exposes just 2 calls:

  • 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

This app requires Redis, and assumes it's available at localhost:6379

Configuration

There are few environment variables you can set:

  • REDIS_HOST - Default: localhost
  • REDIS_PORT - Default: 6379
  • LISTEN_PORT - Default: 3000

Usage

For development use:

npm run start

For building use:

npm run build

To create the docker image use:

npm run image

To push the image use:

npm run push