Created
March 18, 2016 07:35
-
-
Save timothycrosley/3bbcd159be2fe00caf1c to your computer and use it in GitHub Desktop.
Chainable Routing
This file contains 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
import hug | |
api = hug.get(on_invalid=hug.redirect.not_found) | |
@api.urls('/do-math', examples='number_1=1&number_2=2') | |
def math(number_1: hug.types.number, number_2: hug.types.number): | |
return number_1 + number_2 | |
@api | |
def happy_birthday(name, age: hug.types.number): | |
"""Says happy birthday to a user""" | |
return "Happy {age} Birthday {name}!".format(**locals()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment