-
-
Save tallykatt/c3391c829c4717484bb755728a8fb480 to your computer and use it in GitHub Desktop.
Hack router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ {'/'} = () ==> { | |
return | |
<html> | |
<head> | |
<title>Homepage</title> | |
</head> | |
<body> | |
<p>Welcome to my Homepage.</p> | |
</body> | |
</html>; | |
}; | |
$ {'/journal'} = is (HTTP_GET) ?: check (true) ?: () ==> { | |
return | |
<html> | |
<head> | |
<title>Congrats</title> | |
</head> | |
<body> | |
<p>Hello, you passed the test.</p> | |
</body> | |
</html>; | |
}; | |
$ {'/hello/(name:w)/(city:w)'} = is (HTTP_GET) ?: $params ==> { | |
return | |
<html> | |
<head> | |
<title>Hello {$params['name']}!</title> | |
</head> | |
<body> | |
<p>Welcome back, {$params['name']}. Here is the latest news for {$params['city']}.</p> | |
</body> | |
</html>; | |
}; | |
$ {'/account/(username:*)'} = $params ==> "Hello {$params['username']}!"; | |
$ {404} = (): :html ==> { | |
return | |
<html> | |
<head> | |
<title>Page not found</title> | |
</head> | |
<body> | |
<p>Woops, that page does not exist yet!</p> | |
</body> | |
</html>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment