Skip to content

Commit 6c1b96c

Browse files
SimonDanischshashi
authored andcommitted
allow serving function to route
1 parent 934bfb1 commit 6c1b96c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/providers/generic_http.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ function asseturl(file)
3131
end
3232

3333
function serve_assets(req, serve_page)
34-
if req.target == "/"
35-
return serve_page()
36-
end
34+
response = serve_page(req)
35+
response === missing || return response
3736
if haskey(AssetRegistry.registry, req.target)
3837
filepath = AssetRegistry.registry[req.target]
3938
if isfile(filepath)
@@ -87,7 +86,8 @@ const app = Ref{Any}()
8786
server = WebIOServer(
8887
baseurl = base_url, http_port = asset_port, ws_port = websocket_port,
8988
logging_io = stdout
90-
) do
89+
) do req
90+
req.target != "/" && return missing # don't do anything
9191
isassigned(app) || return "no app"
9292
ws_url = string("ws://", base_url, ':', websocket_port)
9393
webio_script = asseturl("/webio/dist/bundle.js")
@@ -122,7 +122,7 @@ app[] = node(:div, "Hello, World",
122122
```
123123
"""
124124
function WebIOServer(
125-
default_response::Function = ()-> "";
125+
default_response::Function = (req)-> missing;
126126
baseurl::String = "127.0.0.1", http_port::Int = "8081",
127127
ws_port::Int = 8000, verbose = false, singleton = true,
128128
logging_io = devnull

0 commit comments

Comments
 (0)