Created
November 29, 2018 23:26
-
-
Save tym-xqo/504693af93b103d588479f78e187ae80 to your computer and use it in GitHub Desktop.
Responder routing with optional path
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
import responder | |
api = responder.API() | |
@api.route("/") | |
def hmm(req, resp): | |
resp.media = {"status": "ok"} | |
@api.route("/path") | |
@api.route("/path/{opt}") | |
def hello_to(req, resp, *, opt='default'): | |
resp.media = {"status": "ok", | |
"option": opt} | |
if __name__ == "__main__": | |
api.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment