Skip to content

Instantly share code, notes, and snippets.

@tym-xqo
Created November 29, 2018 23:26
Show Gist options
  • Save tym-xqo/504693af93b103d588479f78e187ae80 to your computer and use it in GitHub Desktop.
Save tym-xqo/504693af93b103d588479f78e187ae80 to your computer and use it in GitHub Desktop.
Responder routing with optional path
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