From 678596ace4ec006d1ef87b59bc9c777e80bc6ca2 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 11 Oct 2018 11:41:22 -0400 Subject: [PATCH] readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 28b4747..2a10da1 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,20 @@ def on_request(req, resp, *, greeting): # or on_get... resp.status_code = api.status_codes.HTTP_416 ``` +Render a template, with arguments: + +```python +@api.route("/{greeting}") +def greet_world(req, resp, *, greeting): + resp.content = api.template("index.html", greeting=greeting) + +The `api` instance is available as an object during template rendering. + +if __name__ == '__main__': + api.run() +``` + + # The Basic Idea The primary concept here is to bring the nicities that are brought forth from both Flask and Falcon and unify them into a single framework, along with some new ideas I have. I also wanted to take some of the API primitaves that are instilled in the Requests library and put them into a web framework. So, you'll find a lot of parallels here with Requests: