WIP: add http middleware template#3617
Conversation
Signed-off-by: Michelle Dhanani <mdhanani@akamai.com>
| @@ -0,0 +1,10 @@ | |||
| [[trigger.http]] | |||
There was a problem hiding this comment.
The current templating system requires the add snippet to contain a trigger section which doesn't make sense for a middleware component (or any library component).
There was a problem hiding this comment.
Huh, weird. I think we used to check the trigger to make sure it was the same as existing triggers. I don't think that would be needed any more - let's see how the trigger info is being depended on and see if we can bin it off.
| [add_component] | ||
| skip_files = ["spin.toml"] | ||
| [add_component.snippets] | ||
| component = "component.txt" |
There was a problem hiding this comment.
Adding middleware to an existing app would require post add instructions including adding the middleware to dependencies under the correct trigger section.
There was a problem hiding this comment.
This may be unavoidable - presumably the reason you're building your thing as middleware rather than including it in component source code is that you want to apply it to multiple triggers. (Although I guess another case is "my app is an off-the-shelf component like the fileserver but I want to wrap it." So maybe sometimes we do want to be able to auto-add it to triggers. But yeah, we don't have syntax for that yet.)
| @@ -0,0 +1,14 @@ | |||
| spin_manifest_version = 2 | |||
There was a problem hiding this comment.
There's not really a clear way to test middleware as a standalone spin app unless we revive (I think)spin test
There was a problem hiding this comment.
When I briefly looked at a middleware template, I assumed it would have to be add-only (not available in spin new). Even with spin test it's not clear how a standalone piece of middleware could work.
Opened up this draft PR as an additional resource to visualize #3618.
This is an attempt to add an http middleware template for both the
spin newandspin addexperience. I ran into a few issues.