Replies: 6 comments 1 reply
-
Hello @pnico, Sorry for the long delay here! I was out and couldn't reply before 😄. Let me reopen this issue, so we can discuss about it and create any new issue.
We have discussed this in the past, but never created a Discord or other channel. About Discussions, do you mean GitHub discussions? We were thinking on enabling that option.
In general, this would depend on the programming language ecosystem. The workers could be a source code (like JavaScript) or a compiled module (like Rust). For compiled languages, the source code project structure is out of Wasm Workers Server as it expects to run the compiled modules. That approach provides flexibility about how you share code between different workers. The same principles applies to some interpreted languages like JavaScript. You can have a source project that outputs a set of workers using bundling and transpiling techniques. Note this is required when using libraries as In general, the workers model focuses on single and small units that are deployed individually. The tooling ensures you get a single file (either a single source code file or a compiled module) that you deploy to a platform. Wasm Workers Server goes a bit further there and allows you to define an entire application but routing multiple workers from a given folder. We are still defining the shape of this. To help us, what are the kind of applications you have mind?
These are good points. Filesystem routing is quite convenient, but it has its limitations. One option we were thinking here is the ability to set the URL and contraints around it in the associated configuration file. If Another option could be to define a top level Giving these two options, what would you prefer?
This is something I would love to research more. I believe it's too early to provide a response for this, but it will give it a thought :) Thank you for your questions and interest and sorry for the delay! |
Beta Was this translation helpful? Give feedback.
-
IMO, I would prefer a route config file rather than a top level one. Multiple config files could allow you to add other parameters in the future (like a scheduled job) |
Beta Was this translation helpful? Give feedback.
-
+1. Cron-jobs are something we have in mind and yes, you would need to use individual config files :) |
Beta Was this translation helpful? Give feedback.
-
I would also add that you can not declare the same route twice with file based routing. |
Beta Was this translation helpful? Give feedback.
-
Thanks for changing this to a discussion, I feel less self-conscious about it now 😂
|
Beta Was this translation helpful? Give feedback.
-
As a summary, workers with internal routing logic is already covered by the For now, version = "1"
name = "users-api"
urls = ["/api/[version]/users/"] |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
This is something I would probably put in a Discussions item or a Discord channel if those were available, let me know if there's a better place for questions like this.
While the filesystem-based routing is elegant and kinda neat, I wonder about a few things:
/api/v1/something
,/api/v2/something
etc., where v2 might share a lot of code with v1 with some changes? Or is this just not something that fits with the 'workers' paradigm?Then another thing that's unrelated to routing..
Describe the solution you'd like
(Just curious, no solutions necessary 😄)
Describe alternatives you've considered
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions