the URL shortener, line by line
(User) -> [Shortener] : shorten({Url}) => {Code} | a user sends a URL, gets a code |
[Shortener] -> |Links| : save({Code}, {Url}) | the pair is stored |
(Visitor) -> [Redirect] : follow({Code}) | a visitor follows a code |
[Redirect] -> |Links| : lookup({Code}) => {Url} | it’s looked up |
!> (Visitor) : <NotFound> | missing: not found |
-> (Visitor) : redirect({Url}) | found: redirected |
~> <Clicked> -> [Stats] | each click, async, to stats |
A line that starts with an arrow continues from the subject above.
Simulate it in the playground below: happy, and
Redirect.lookup:fails, which ends on the !> route.