clicks-counter/README.md

41 lines
774 B
Markdown
Raw Normal View History

2018-10-16 18:03:16 +00:00
# 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.
2018-10-16 18:03:16 +00:00
2018-10-17 14:26:31 +00:00
# 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`
2018-10-16 18:03:16 +00:00
# Usage
For development use:
```
npm run start
```
For building use:
```
npm run build
```
2018-10-17 14:26:31 +00:00
To create the docker image use:
```
npm run image
```
To push the image use:
```
npm run push
```