Re:WTF: A personal information dashboard for your terminal
by brink on Thursday May 31, 2018 @12:14PM
(#17197467)
I'm also a Go noob. I tried writing a basic web server in Go yesterday to handle Twilio SMS callbacks. Trying to inspect the requests I was receiving was such a pain, I gave up and wrote the server with Sinatra. Am I missing something that's making this more difficult than it should be?
[ Parent
| on HN ]
Re:WTF: A personal information dashboard for your terminal
by alyandon on Thursday May 31, 2018 @12:19PM
(#17197535)
You were probably missing something but we all had to start someplace. :)
I'm not a Go expert by any stretch of the imagination and I can tell you that almost everything you would want to know about a given request is exposed through the request object passed to your handler if you are using the standard Go http stuff.
Re:WTF: A personal information dashboard for your terminal
by dcardoza on Thursday May 31, 2018 @01:00PM
(#17197960)
I love Go specifically for this purpose. I wrote a simple server doing exactly that with Twilio: https://github.com/dang3r/jenophone/
Re:WTF: A personal information dashboard for your terminal
by brink on Thursday May 31, 2018 @01:30PM
(#17198278)
Thanks! I'll check it out.
Re:WTF: A personal information dashboard for your terminal
by jen20 on Thursday May 31, 2018 @10:17PM
(#17202107)
`httputil.DumpRequest`[1] may have been helpful in this situation. If you're on a mainstream platform, the Delve debugger is fairly reasonable these days too.
Re:WTF: A personal information dashboard for your terminal
by manveru on Thursday May 31, 2018 @06:56PM
(#17201051)
I'd say you were missing https://github.com/k0kubun/pp but the other tricky thing is that you can read a http.Request.Body only once unlike in Ruby. I usually use ioutil.ReadAll for that.
Re:WTF: A personal information dashboard for your terminal
by workinthehead on Friday June 01, 2018 @04:49AM
(#17203644)
That's incorrect. Both languages require you to rewind the reader before you can read it a second time. You're probably just used to higher level frameworks like Sinatra or Rails that take care of it for you.