Skip to content

Add URL shortner example - #99

Merged
ryanking13 merged 1 commit into
mainfrom
gyeongjae/shortner
Sep 2, 2026
Merged

Add URL shortner example#99
ryanking13 merged 1 commit into
mainfrom
gyeongjae/shortner

Conversation

@ryanking13

Copy link
Copy Markdown
Contributor

It looks like we don't have a good example using workers KV, so I added one.

Comment on lines +36 to +38
code = path.lstrip("/")
if not code or "/" in code:
return error("not found", 404)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only take the first component of the url here? So that https://thisworker.com/somecode/some/path works?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think URL shorteners support that normally?

@ryanking13
ryanking13 merged commit e012d94 into main Sep 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants