One package and one command for both frontend and backend
Closed this issue · 4 comments
Just like in Streamlit or Gradio.
Can we set the frontend port to 80 by default instead of 3000? It will make the life of ordinary users easier. They don't know what port is and will be freaked when they see :[PORT]
in the URL.
Also, let the frontend app's URL be {hostname}/{function_name}
? So the URL to ordinary people can be short.
To be honest, the backend
address is needed because our project is front- and back-end separated and you have to specify where the front-end is using the service from.
So the best path would be: {hostname}?backend={backend}&function={function_name}
To be honest, the
backend
address is needed because our project is front- and back-end separated and you have to specify where the front-end is using the service from.
Yes, the frontend needs to know the backend address is but passing the backend address in the URL of a frontend app is bad solution. It is too long and ugly.
Instead, the backend's URL, including port, should be passed to the frontend without the awareness or intervention of users.
The frontend app's URL in Gradio or Streamlit is as simple as hostname:port
. Since they are open source, maybe you can take a look how they do it.
One solution is to start the backend server first. Then passing the backend URL as an argument when starting the frontend server, like
yarn start --backend localhost --backend-port 3000
Or use environment variables. Or use config files - backend writes to it and frontend reads.
Or let the frontend scan ports.
So the best path would be:
{hostname}?backend={backend}&function={function_name}
Question mark ?
is not good. User /
.