-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiPart Server Functions #1868
Comments
Yes some kind of helper makes sense to me. I haven't worked with multipart forms much before, so I'm very open to API suggestions. Do you want to do some work on this one? |
Sure, I think I see a way to build it. I'll reach out if I have any questions |
So I've dug into this a bit, and see a few options
|
Related thought: While we're at it, it would be worth making parts of the server fn implementation generic rather than using an enum for Payload and so on. IIRC the encodings both for sending the request and decoding the response are stored in an enum which means they both need to be present at runtime. There could be WASM binary savings if we make it generic over the encoding (which shouldn't change at runtime anyway) instead. Especially if we're adding another encoding. |
Actually this is something that I've been thinking about, if we could open up some of the bounds on Server Functions, we could provide a lot more options for encoding.
What if we moved away from a bound on Serialize/Deserialize, and instead created our own traits like IntoRequest/FromResponse? We could implement those for different encodings and for T: Serialize/Deserialize, and it would make some things like Multipart a LOT easier to write.
…On Tue, Oct 10, 2023, at 1:35 PM, Greg Johnston wrote:
Related thought: While we're at it, it would be worth making parts of the server fn implementation generic rather than using an enum for Payload and so on. IIRC the encodings both for sending the request and decoding the response are stored in an enum which means they both need to be present at runtime. There could be WASM binary savings if we make it generic over the encoding (which shouldn't change at runtime anyway) instead. Especially if we're adding another encoding.
—
Reply to this email directly, view it on GitHub <#1868 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABVBTCJZGM46MXEYHKOCNCTX6WWR3AVCNFSM6AAAAAA5X5NJYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJWGE4TCMRWHE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
trying to get file uploads working. it seems like there is an extractor |
Yes, currently your best approach is to use a regular axum handler to handle multipart uploads |
For anyone who's curious, our rewrite of server functions (https://github.com/gbj/server_fns) does, in fact, now support multipart uploads (and streaming responses), so this should be included in the next release. |
I was curious how the new implementation is done and was going through the history of the code, and I gotta say - love your commit messages 🤣 |
Done in #2158. |
Basically I think it'd be great to have a Sever Function encoding called
MultiPartJson
andMutltiPartCbor
with the goal of making multipart form submissions to server functions easier.I think we could create a
MultipartActionForm
component to serialize form data and any uploaded files into a FormData object. That could be sent to the server function route, and arguments to that server fn could be deconstructed from that FormData object with crates like axum_typed_multipartMy primary motivator is to make the processing of file uploads super easy, while keeping the Server Fn infrastructure
The text was updated successfully, but these errors were encountered: