2015-12-06 14:05:16 +00:00
|
|
|
# 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.
|
2015-12-06 14:05:16 +00:00
|
|
|
|
|
|
|
```erb
|
2015-12-16 18:32:01 +00:00
|
|
|
Hello <%= env.params["name"] %>
|
2015-12-06 14:05:16 +00:00
|
|
|
```
|