chapar-rest / chapar

Chapar is a simple and easy to use api testing tools aims to help developers to test their api endpoints. it support http and grpc protocols.
https://chapar.rest
BSD 3-Clause "New" or "Revised" License
485 stars 24 forks source link

Web / wasm #102

Open gedw99 opened 1 week ago

gedw99 commented 1 week ago

Anyone tried running this as a web app ?

The FS access would be a problem ?

mirzakhany commented 6 days ago

Both FS and sending request from browser would be a problem. to be able to work in browser

gedw99 commented 6 days ago

I remember suggesting a Provider pattern to gio leads 2 or 3 years ago to solve this as I saw it coming . Fell on deaf ears . Most devs were hot on native I think and were not into web .

https://developer.mozilla.org/en-US/docs/Web/API/File_System_API

now with A2HS in all browsers ( even Apple the hold outs ) you can try deploy via a WebView or browser and also not have the signing / trust fees and hassle since your already in the browser sandbox so the users are protected from dodgy developers .

the WASM golang project for cloud flare workers has this provider pattern to solve the http and fs problem . Been using it and workers great.

https://github.com/syumai/workers

The FS is object storage / R2 The HTTP calls are bridged . Very simple code .

the same for WASM running inside wazero . Needs provider pattern to talk to fs and network .

https://github.com/tetratelabs/wazero/blob/main/fsconfig.go

Just saying what I know . Not saying it’s a short coming of Chapar or your efforts …

the best way to do this I found is to write golang that talks over stdio . Then the stdio is bound to a provider for FS and Network through the WASM runner .

Deck does this for everything :

https://github.com/ajstarks/decksh/blob/master/cmd/decksh/decksh.go

Now I just use htmx and web for everything with the golang running as WASM in the client and the server . Sure it’s not as performative, but it removes a lot or as the Brits call “ argy bargy “.

the gio can run above it if needed still bridging o the fs / network as needed.

https://github.com/wasmvision/wasmvision is a good example and it lads the WASM at runtime from a remote source . It’s fine because the WASM is sandboxed .the browser too .

None of this is perfect and it’s a big effort to do .

Anyways this long response might be interesting or give you ideas .