From 543903fd77160c84ad4f9f4a0ce591f73d8a58bf Mon Sep 17 00:00:00 2001 From: Drew McArthur Date: Sat, 20 Jan 2024 22:30:06 -0700 Subject: [PATCH] Update README.md --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44ae9fd..289b6d2 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,32 @@ it was cloned from [the cloudflare/workers-sdk/templates/experimental/worker-rus ## routes -the app only has a handful of routes that it serves, so here's an outline. +the app only has a handful of routes that it serves, so here's an outline. routes are defined in [src/lib.rs](https://github.com/DrewMcArthur/qrstats/blob/2e82945bb15d31f05d3499650dbb0394a84cd049/src/lib.rs#L36) ### GET /index the index page is a simple landing page, which explains how the app works and allows the user to create a redirect for their URL, as well as an optional password to secure their stats, as well as some other configuration. this is managed via a simple HTML form, which POSTs the request to a qrstats-worker, and is handled there. +### GET /create + +a form for creating a new tracked URL. requires a URL, and optionally accepts a custom ID and password. + +### POST /create + +sends the data from the form on the above page to the server to be added to the KV store. returns either `views::create_success` or `views::create_error` + +### GET /redirect/:id + +fetches the URL for the given ID, increments the saved count for that tracked URL, and issues an HTTP Redirect response to the stored URL. + ### GET /stats -this page allows the user to "login", either via their url, or the ID they were given, along with an optional password. +this page allows the user to "login", either via their id along with an optional password. + +### POST /stats + +this returns the stats for the ID from the form above. + +### GET /stats/:id + +this attempts to authenticate, and either returns a similar response to POST /stats, or redirects to the GET /stats login page.