make an endpoint for every file in the server directory, with a bind being the file name
make an endpoint for index.html to be in root /
serve request for files that endpoints were made for; for others, a generic 500 was returned.
the new flow: 1. request server start 2. make an endpoint for index.html to be in root / 3. when a request is made, the fallback function is called with a bind being the endpoint 4. open file in the server directory if it exists, if not, or if reading the file fails, return 500.
since e44cac165a, godot-http-server was synced with upstream (where relevant), the binds system was deprecated, and the flow is updated to not use the fallback function:
request server start
make an endpoint for "/", which would match any path, and bind it to the _serve_file() function
open file in the server directory if it exists. if not, or if reading the file fails, return 500.
additionally, if the endpoint is /, replace the file path with index.html.
this also gave me an idea: in the future, it would be cool to specify custom error pages
~~partially~~ addresses #8.
the old server flow was:
1. request server start
2. make an endpoint for every file in the server directory, with a bind being the file name
3. make an endpoint for `index.html` to be in root `/`
4. serve request for files that endpoints were made for; for others, a generic 500 was returned.
~~the new flow:~~
~~1. request server start~~
~~2. make an endpoint for `index.html` to be in root `/`~~
~~3. when a request is made, the fallback function is called with a bind being the endpoint~~
~~4. open file in the server directory if it exists, if not, or if reading the file fails, return 500.~~
since e44cac165a, [godot-http-server](https://https://github.com/velopman/godot-http-server/) was synced with upstream (where relevant), the binds system was deprecated, and the flow is updated to not use the fallback function:
1. request server start
2. make an endpoint for "/", which would match any path, and bind it to the `_serve_file()` function
3. open file in the server directory if it exists. if not, or if reading the file fails, return 500.
1. additionally, if the endpoint is `/`, replace the file path with `index.html`.
this also gave me an idea: in the future, it would be cool to specify custom error pages
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
partiallyaddresses #8.the old server flow was:
index.htmlto be in root/the new flow:1. request server start2. make an endpoint forindex.htmlto be in root/3. when a request is made, the fallback function is called with a bind being the endpoint4. open file in the server directory if it exists, if not, or if reading the file fails, return 500.since
e44cac165a, godot-http-server was synced with upstream (where relevant), the binds system was deprecated, and the flow is updated to not use the fallback function:_serve_file()function/, replace the file path withindex.html.this also gave me an idea: in the future, it would be cool to specify custom error pages