You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each branch needs to terminate somewhere with a middleware that expects a single argument (like notfound() or respond("something")). route and method are both branching middlewares: they expect not to be last in the tree of functions to call.
Try:
julia>using Mux
julia>using Mux: notfound
julia>@app app = (
Mux.defaults,
method("GET",
route("path/to/this", respond("hi")),
notfound()
),
method("POST",
route("path/to/that", respond("bye!")),
notfound()
),
notfound(),
)
julia>serve(app)
Task (runnable) @0x00007fbbcbe931f0
shell> curl http://localhost:8000/path/to/this
hi
shell> curl -X POST http://localhost:8000/path/to/this
Not found
shell> curl -X POST http://localhost:8000/path/to/that
bye!
e.g.
The text was updated successfully, but these errors were encountered: