ftd.response
with rudimentary variable interpolation
#2066
amitu
started this conversation in
Ideas & RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We will add
-- ftd.reponse:
that can be used to generate non HTML response. This is in line withftd.json
feature.ftd.response
will most likely remain in final version, this is how templates will return non fastn generated HTML tree. In future we will pass a template object toftd.response
in thecaption
field.For now we pass content in the body field. All the kw-args will be variable substituted using the
$<var-name>
syntax:A file with above will generate
text/html
response.The priority of
ftd.response
is lower thanftd.json
(if a file produces both we will return json). We have to pick one and this is an arbitrary decision.You can use
if
to return HTML only if some condition is met. The variables themselves can have one or more values, and if can be used (eventually).Note we have not passed the
name
variable as expected. It will produce:In future it may return an error. But this is type unsafe and errors are runtime errors, this is why we are building the type safe templating.
Beta Was this translation helpful? Give feedback.
All reactions