kemal/docs/views.md

16 lines
264 B
Markdown
Raw Normal View History

# Views
2015-12-16 18:32:01 +00:00
You can use ERB-like built-in **ECR** views to render files.
2015-12-07 20:03:35 +00:00
```crystal
2015-12-16 18:32:01 +00:00
get '/:name' do
2015-12-07 20:03:35 +00:00
render "views/hello.ecr"
end
```
2015-12-16 18:32:01 +00:00
And you should have an `hello.ecr` view. It will have the same context as the method.
```erb
2015-12-16 18:32:01 +00:00
Hello <%= env.params["name"] %>
```