-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
we need more examples #28
Comments
Is this possible with Mux at the moment? If not, it can't be used for any sort of real situation... |
If I use resp = Response(200, getHeaders(), JSON.json(Dict("data" => 1, "error" => false))) but I can't figure out to attach it to a route in Mux -- things like @app test = (
Mux.defaults,
page(respond("Nothing to see here...")),
route("/test", req -> respond(Response(200, getHeaders(), "meh"))),
Mux.notfound()
)
serve(test, port=7777) don't work. |
it seems you can return a Dict with |
It seems like it should work, but that returns a response with default headers and no body no matter what: @app test = (
Mux.defaults,
page(respond("Nothing to see here...")),
route("/squareit", squareit),
route("/solveit", solveit),
page("/test", req -> Dict("body" => "meh")),
Mux.notfound()
) returns the following for all three of the routes
|
It took me a day to work it out, but here it is so people don't have to follow....
|
Ugh, not sure how I managed to not find this while flailing around. Thanks!!! |
Add `@compat` in some places
REQUIRE 0.4 release
I'm trying to build a mux based system, but we have no examples around setting headers, and how to put stuff in various parts of the chain.
I've tried...
but, the app(req) is not a response object. and I have no way I can find of turning it into one.
The examples all seem to think that app(req) does give you a response object.
and if you want many of your pages to use the same middle layer AFTER the page call, how do you tell it to do that?
The text was updated successfully, but these errors were encountered: