REST backend within browser

I’m caressing the idea of developing a hobby web application, whose front end I’ll place in Firefox extension pages.

This may not be practical, but the idea is to implement suitable REST back ends as required (for each platform, possibly in different languages). But if I were to package the application as a Firefox extension (i.e., both front and back ends in JS), I wonder how I can implement a REST back end in Firefox if at all that’s possible. WebSocket server in WebWorkers/ServiceWorkers?

Conceivably, the front end will have a setting to pick a back end to connect to. For example, for a back end that I’d run on my host, I’d say localhost:8000/foo/bar. If an in-browser back end were possible, I’m not sure how that’d look like.

Any ideas?

You can’t run a traditional web backend within an extension. Packaging a “web app” as extension means you’ll have to write your backend very differently, using messaging and also running in a web context. You can also do a service worker based approach, I think.

1 Like