Skip to content
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

Server on 0.0.0.0 #44

Closed
mrkimo1998 opened this issue Apr 17, 2017 · 2 comments
Closed

Server on 0.0.0.0 #44

mrkimo1998 opened this issue Apr 17, 2017 · 2 comments

Comments

@mrkimo1998
Copy link

mrkimo1998 commented Apr 17, 2017

using Mux

@app test = (
  Mux.defaults,
  page(respond("<h1>Hi</h1")),
  Mux.notfound())
@sync serve(test, port=1234)

Only spawns a Server on 0.0.0.0:1234
how is that changeable ? host=127.0.0.1 in the serve doesnt work

@catethos
Copy link

Looking at the source code here

function serve(s::Server, port = default_port; kws...)
  @async @errs run(s; port = port, kws...)
  return
end

The serve function takes in extra keyword arguments that pass into the run function in HTTPServer.jl . So we can pass in the host like this

using HttpServer
using Mux

@app test = (
  Mux.defaults,
  page(respond("<h1>Hi</h1")),
  Mux.notfound())
@sync serve(test, port=1234,host=IPv4(127,0,0,1))

amellnik pushed a commit to amellnik/Mux.jl that referenced this issue Apr 17, 2018
@cmcaine
Copy link
Collaborator

cmcaine commented Dec 6, 2020

This can now be done with serve(app, host, port). This can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants