Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/horusiath/country-counter
https://github.com/horusiath/country-counter
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/horusiath/country-counter
- Owner: Horusiath
- Created: 2023-11-06T01:40:40.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-13T11:01:19.000Z (about 1 year ago)
- Last Synced: 2024-10-16T09:48:07.896Z (3 months ago)
- Language: Rust
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Country counter
A demo project for integrating Cloudflare Workers and [libsql-client](https://docs.rs/libsql-client/latest/libsql_client/).
## Description
This demo project implements a simple per-location counter. Each visit of the page bumps
a counter associated with the location of the Cloudflare Worker instance that ran
the particular request.All visited locations are also visualized with the help of [Mappa](https://mappa.js.org/docs/simple-map.html).
## Setup
To prepare the environment, set up Cloudflare Workers' `wrangler` tool:
https://developers.cloudflare.com/workers/wrangler/install-and-update/To set up the database, first join the beta for ChiselStrike Turso: https://chiselstrike.com/
Then, create your database and create the following entries in `.dev.vars` file, or register them
as [secrets](https://developers.cloudflare.com/workers/wrangler/commands/#secret) on Cloudflare.
```
LIBSQL_CLIENT_URL = "https://"
LIBSQL_CLIENT_USER = ""
LIBSQL_CLIENT_PASS = ""
```## Development
To run the example:
1. Run `wrangler dev`
2. Visit your page at localhost:8787## Live demo
The example is also deployed live here: https://country-counter.p-sarna.workers.dev/