ethereumjs-monorepo icon indicating copy to clipboard operation
ethereumjs-monorepo copied to clipboard

switch rpc.ts to `itty-router` instead of `connect` `cors` `body-parser`

Open foufrix opened this issue 1 year ago • 3 comments

Following discussion in #3450

Attempt to move client/src/util/rpc.ts to itty-router to remove body-parser connect cors

It's not working now, from what I understood, we will need to add an adapter @whatwg-node/server, if someone can confirm that @holgerd77 @acolytec3

Documentation about that can be found here

Still trying to understand what I'm doing wrong here

foufrix avatar Jun 21 '24 11:06 foufrix

Sorry for not commenting sooner but if it turns it we need that whatwyg/node dependency for itty-router to work, we're not gaining anything as that brings in another 5-6 dependencies of it's own. I took an initial look and seems like itty-router might not be the right choice after all. I will take another look this week but we might want to look for alternatives that work with less hassle

acolytec3 avatar Jun 23 '24 20:06 acolytec3

Hey @acolytec3, sorry for the late reply. I was away.

I'm not 100% sure that we need it, but the adapter seems necessary to use the HTTP createServer method. I don't know if we can do without this HTTP createServer method that we pass to Node.

foufrix avatar Jul 10 '24 09:07 foufrix

Hey @acolytec3, sorry for the late reply. I was away.

I'm not 100% sure that we need it, but the adapter seems necessary to use the HTTP createServer method. I don't know if we can do without this HTTP createServer method that we pass to Node.

Understood. If that's the case, I don't think we should go with itty-router. The whole idea was to reduce our dependency subtree for connect/cors/body-parser. If there isn't something similar that doesn't require shims and additional deps to make it work, we might as well just stick with what we have now or internalize it (though I don't love that idea all that much).

acolytec3 avatar Jul 10 '24 19:07 acolytec3

Needs another approach and no follow-up, will close

holgerd77 avatar Oct 11 '24 08:10 holgerd77