You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Spin defines its triggers through a WebAssembly interface (through a WIT file).
Implementing a component (Wasm module) for a particular trigger means implementing its interface.
Because a module can only contain at most one implementation of the same interface (the function that implements the trigger is the "entrypoint" function, and is exported by name), it cannot export more than one such "entrypoint".
(the entrypoint can contain logic and call other functions, but directly, a trigger can currently only execute the one entrypoint).
With the HTTP trigger, one common scenario is writing multiple route handlers within the same "project".
How should this be handled with Spin? The two clear options at first are:
the entrypoint handles all routes / subroutes, and it should contain logic to call other functions in the module
one module corresponds to one route, each with an entrypoint that handles the single route, and it should be the responsibility of a higher level tool + configuration (ref Configuration for Spin applications #17) to assemble multiple such routes.
Note that this requires no actual implementation changes to the current HTTP trigger, but has an impact on configuration, documentation, and templates.
The text was updated successfully, but these errors were encountered:
One thing that should be mentioned is that the same Wasm module can implement multiple interfaces at the same time, and could potentially be used as the entrypoint module for multiple triggers.
Currently, Spin defines its triggers through a WebAssembly interface (through a WIT file).
Implementing a component (Wasm module) for a particular trigger means implementing its interface.
Because a module can only contain at most one implementation of the same interface (the function that implements the trigger is the "entrypoint" function, and is exported by name), it cannot export more than one such "entrypoint".
(the entrypoint can contain logic and call other functions, but directly, a trigger can currently only execute the one entrypoint).
With the HTTP trigger, one common scenario is writing multiple route handlers within the same "project".
How should this be handled with Spin? The two clear options at first are:
Note that this requires no actual implementation changes to the current HTTP trigger, but has an impact on configuration, documentation, and templates.
The text was updated successfully, but these errors were encountered: