stretchr / goweb

A lightweight RESTful web framework for Go
632 stars 61 forks source link

Why not use Goweb? #49

Closed matryer closed 10 years ago

matryer commented 10 years ago

Please leave a comment and tell us:

tgulacsi commented 10 years ago

Unscalable codecs - see https://github.com/stretchr/codecs/issues/21

matryer commented 10 years ago

Thanks for the feedback.

On 3 Sep 2013, at 20:10, Islan Dberry notifications@github.com wrote:

I did not use goweb because I thought it would take longer to learn and understand goweb than it would to just write some code.

— Reply to this email directly or view it on GitHub.

oleksandr commented 10 years ago

We tried to use net/http directly but ended up thinking again on generalizing response functions (read "controllers" used the same in different places), mapping requests and parameters to functions and keeping them the right RESTful way. It's an overhead from a project to project (not talking about small projects to roll out quicklt a bunch of resources). With Goweb we had to focus only on the following:

oleksandr commented 10 years ago

Such a relief :-) Even though Goweb put some constraints they are hackable. We didn't wont to end with Gorilla-based mambo-jumbo in Go ;-)

an2deg commented 10 years ago

I don't like a way how Goweb works with variables in mapping paths. It uses ugly github.com/stretchr/stew/objects (compare it with github.com/bitly/go-simplejson) All Get* methods except GetString() return interface{} and I have to manually convert each value into proper type. go-simplejson works in different way: Get() method returns Json object which has Int(), String(), Array() and e.t.c. methods. For example: js.Get("top_level").Get("array").GetIndex(1).Get("key").Int()

matryer commented 10 years ago

@an2deg we agree actually - so have tweaked the way Goweb deals with data by introducing the Objx package.

an2deg commented 10 years ago

@matryer Great!

lukescott commented 10 years ago

As a new user to goweb, these were my initial thoughts, right or wrong:

jaredbischof commented 10 years ago

I would like to use Goweb to run a server application on port 80 as a non-root user. Is this possible with Goweb 2? Currently I'm using Goweb version 1 and I found that if I use setgid and setuid after starting a server as root with Goweb the new threads that Goweb serves are still owned by root. This leads me to believe if did setgid and setuid inside Goweb that I could fix this, but I was wondering if this could be handled more gracefully with Goweb 2.

lukescott commented 10 years ago

@jaredbischof You can do this without root using setcap. setcap 'cap_net_bind_service=+ep' /path/to/program

jaredbischof commented 10 years ago

That's actually precisely what I'm doing right now. :) I was just curious if there was a way to handle this inside golang for all threads.

lukescott commented 10 years ago

@jaredbischof Currently, not easily. That's a Go limitation though. It's difficult to ensure every thread does setuid/setgid (https://code.google.com/p/go/issues/detail?id=1435). setcap is actually safer because binding to port <1024 is all the program can do. privbind is another option.

jaredbischof commented 10 years ago

Yeah, I saw that issue. Noticed it was pretty old, so I thought it might have been fixed. But, thanks for confirming I'm taking the correct approach!

On Tue, Nov 19, 2013 at 1:45 PM, Luke Scott notifications@github.comwrote:

@jaredbischof https://github.com/jaredbischof Currently, not easily. That's a Go limitation though. It's difficult to ensure every thread does setuid/setgid (https://code.google.com/p/go/issues/detail?id=1435). setcap is actually safer because binding to port <1024 is all the program can do. privbind is another option.

— Reply to this email directly or view it on GitHubhttps://github.com/stretchr/goweb/issues/49#issuecomment-28825776 .

oleksandr commented 10 years ago

Goweb mentioned on TheChangeLog:

http://lists.thechangelog.com/t/t-FB36C550D1F6B9A7