arcchallenge.go example
ljgww opened this issue · comments
Still having issues compiling this example with golang 1.0.2
time do not have Nanoseconds() func
strconv do not have Itoa64 method FormatInt has been suggested (likely easy to fix this one)
ctx.Request do not have Params map (reports to be of type *http.Request)
That example wasn't written with go1, but a few updates and it works. I've got a commit, rday@ee574e6, which has a working version. Please note, however, that my fork is a bit different and the updated archallenge may not run out of the box on your system.
I have figured out that many Go web examples found on the net are written for some previous version of Go (some sources mention Go ver 0.6.x). Lets see if Go will follow Java example in changing functions and whole libraries in early versions it already seems so although 0.6 is not first release now we have ver 1 so I expect to be more stable (maybe this is just wishful thinking :) )
Anyhow, thank you for the explanation on what to change in examples.
Do you plan bringing up web.go (branch) to ver 1? Basic examples given in readme work out the box for me - now, I'd like to expand. My interest is in having standalone web server. I have adopted some examples from the net to work on Go 1, but your library looks more like developed web app frameworks. Just this example took me to dead-end cause I do not know what was previously happening in Go so it is a lot of guesswork. Thank you! Will hang around.
Shall I move to watch "rday" repo ?
Feel free. I'm building my fork out as I work on a standalone web application at work. I have all the UI code in a static/ directory, and Go support the backend logic. I've added steps to be more Restful, as that is typically the environment I work in. Not quite there yet, but getting closer.
there are 83 forks from your repo, and all of them are originated here.... congrats. I cannot compare them all.
can I ask you couple of questions more?
-
how to reach this part:
//try to serve index.html || index.htm if indexPath := path.Join(path.Join(staticDir, requestPath), "index.html"); fileExists(indexPath) { http.ServeFile(&ctx, ctx.Request, indexPath) return } ( that is ending part of: func (s *Server) routeHandler(req *http.Request, w ResponseWriter) { )
how get request shall be written (or omitted to reach that part of code)? Tried several different approaches but never manged to reach that piece of code (serving local index.html) of course I made a sample index.html file.
-
how to achieve redirection? (do no know if you know for example web.py?) they use something like:
raise web.seeother('/app/stop')
instead of:
return content
for redirection.
redirection is immensely useful when writing web apps
-
congrats, for having:
func (s *Server) Close() {
extremely important, for standalone server.
I have closed the issue because there is working example.