has anybody experience in using a HTML template engine inside the edge? We are looking for an alternative to edge side includes to avoid extra requests to another service.
Which engine did you use? Did you store the templates directly inside the WASM application or something like the ConfigStore in fastly? If you previously used esi, what are the advantages and disadvantes, e.g. did the cost increase because of the extra CPU usage?
I’m really pleased to see that you are exploring different use cases for Compute. Stitching together content at the edge is a great way to take advantage of Fastly’s caching capabilities.
In terms of templating engines, I’ve used tinytemplate in Compute successfully, which is relatively minimal but does the job well for a lot of services. I’ve used this with templates statically included in the code (include_str!) but I see no reason why they couldn’t come from a config store or backend either.
There are also some code examples on our documentation site of using other templating engines in supported Compute languages.
Thanks for the swift reply. Good to know that more than one engine is available. The code example is interesting, because it uses a jinja2 compatible engine. One we are all familiar with , which is good. I guess we have to check both engines and see what suits us better
Since the templates are not huge, using include_str! seems more performant than using the config_store, right?
Although the config store is incredibly performant, if your templates are small I would say it makes the most sense to include them in the binary via include_str!, as they will then already be in memory when needed by the template engine.