Formidable monorepo and v4 perp #997
Open
+1,657
−7,263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Moving to a monorepo and TypeScript.
There will be couple of benefits with that like we can have v1, v2, v3 and others as separate directories and not separate branches. We can make CI builds based on that too.
I played with a lot of variants, so there will be:
packages/v1
(or similar), v2, v3,@mjackson/multipart-parser
What i just started realizing is that the HTTP Multipart is pretty bad, and there might be an alternative way to handle all that a lot better, like..
What if on the backend user defines
formidable(req, options)
but on his frontend he also get theformidableClient(e.target, options)
, the client side part will basically get theFileList
and send in parallel eachFile
to a server endpoint that is handled by theformidable(req)
and just does the validation and checking on the server.That way we can accept multiple requests at the same time and validate and stream to a third-party like S3 or the disk. Usually what happens is, no matter how many files and fields there are, on the server end we (any body parser) get just one stream that we gotta process "synchronously", there's no other way - but that's the nature of streams.
eg. in frontend
and then, on the endpoint backend, you just get the requests, validate it and send it wherever you want (disk or S3).