Sinatra inspired regexp/pattern mux and web framework for Go
Hello... anyone know how to bind to the external interface and not localhost?
ahh found it.. traffic.SetVar("host", "0.0.0.0")
yes exactly, otherwise you can use the TRAFFIC_HOST env variable
I'm sorry for the late reply but I wasn't here yesterday :)
Hi. I can't find example with json. And method neither. What should I do? I find only "WriteJSON" inside the ResponseWriter struct. So I try w.WriteJSON = json and the w.Render("");... Some help? please
yes. Thank you. I thought there was to render something. I'm going to try it.
no problem . otherwise you can just use traffic.ResponseWriter as a normale http.ResponseWriter
and you can do: json.NewEncoder(w).Encode(user)
Hi. I added a <a href="www.facebook.com/etc" but it seems that this will call mysite/www.facebook.com. In order to have the same result I was trying to do a http.Redirect(w, r.Request, r.URL, http.StatusOk) over this routing rule: router.Get("/^www.", function) but it's not working. Is it a valid routing regexp ?
@gianlucarossiinvece the value of the href should starts with http://.
it’s not a problem with traffic, it a normal html/browser thing.
Hello everyone! How do I deliver static content in production mode?
hi @ahhchuu I would use something else like nginx or an s3 bucket for static files in production
David Satime Wallin
Hi all. Got a quick question (or scenario perhaps): I have a small website written using traffic and im now looking to add an SSL cert to the site.
@pilu Question: Where, in the code, is the production-flag actually used? I tried to deploy a project with TRAFFIC_ENV=production and it then refuses to serve static files. All static files return 404 while the rest of the code works. Trying to figure out why
@pilu Mr Annoying is back with another question :-) To enable a new template function i figured i just need to call traffic.TemplateFunc("myNameToCallInTemplate", MyFunction) but that seems to be a wrong assumption.
David Satime Wallin
@pilu Never mind me. Im a dumb shit who forgets to look through all examples in repo. Sorry to bother you.
sorry @dvwallin I was on holiday, glad you already solved it :)