python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.3k stars 580 forks source link

Is it possible to use Eel as a replacement/wrapper for REST API? #621

Open weathon opened 1 year ago

weathon commented 1 year ago

Is your feature request related to a problem? Please describe. I find out calling eel between front end and back end is much easier than doing Rest for small projects.

Describe the solution you'd like Is it possible to use Eel for B/S set up instead of local?

dstricks commented 1 year ago

Hi @weathon, thanks for the question!

Is it possible to use Eel for B/S set up instead of local?

I'm not sure what this means... could you please elaborate? I don't know what B/S means in this context.

weathon commented 1 year ago

Hi @weathon, thanks for the question!

Is it possible to use Eel for B/S set up instead of local?

I'm not sure what this means... could you please elaborate? I don't know what B/S means in this context.

Hi @dstricks

So I think eel is a good alternative to REST API, where I can call the backend function as a function in JS instead of constructing an ajax request. But now the intended usage of eel is local setup. Is it possible to make it just as a normal website where I can call the python backend (on a server) from the user browser? The B/S here means Browser/Server.

doug-benn commented 1 year ago

Hello @weathon

I have done this sort of thing. Using an Eel python function to read a file on the local system and then send the data to the browser/the served Eel html/JavaScript, I then call the python from JavaScript in the browser. You would just have to add functions for any CRUD functions you wanted. E.g. a read function that runs an SQL Query on an SQL Lite data maybe? And if you started Eel with the browser disabled then you could have Eel run "Headless", again not sure why your want that. This is for a locally served "app" with one user making minimal requests for larger projects with multiple requests being processed Eel is probably not the best solution there are better REST API Libraries/frameworks. You could get it to work but not sure why unless you have a use case which Eel probably already fills.