python-eel / Eel

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

Is there any way to change the routing. ie: make i so <localhost>:<eelPort> redirects to main.html instead of having to do <localhost>:<eelPort>/main.html #339

Closed bribrah closed 4 years ago

samuelhwilliams commented 4 years ago

If you want this just for the home page, calling the file 'index.html' should suffice as this is generally the name of the default document returned by webservers. Is that what you mean/does that help?

bribrah commented 4 years ago

It does not, after changing the file to index.html I still get a "404 not found" when attempting to connect to "localhost:8000/" from chrome

bribrah commented 4 years ago

So I managed to implement this by making the following changes in eels init.py

BOTTLE_ROUTES = {
    "/eel.js": (_eel, dict()),
    "/<path:path>": (_static, dict()),
    "/eel": (_websocket, dict(apply=[wbs.websocket])),
    "/": (_static, dict())
}
def _static(path="index.html"):
samuelhwilliams commented 4 years ago

Hi @bribrah. I've done something very similar in https://github.com/samuelhwilliams/Eel/pull/340 that should meet your needs. 👍

samuelhwilliams commented 4 years ago

Released as v0.13.2