gogo / letmegrpc

[maintainer wanted] generates a web form gui from a grpc specification
BSD 3-Clause "New" or "Revised" License
421 stars 48 forks source link

html: add functions for Handler and DefaultHandler #20

Closed roboll closed 8 years ago

roboll commented 8 years ago

Adds functions in the generated file to get http.Handler instead of running with the global http.ListenAndServe - Useful for embedding the ui in other applications. DefaultHandler returns a handler using the DefaultHtmlStringer, and Handler exposes the stringer as an argument.

awalterschulze commented 8 years ago

I think the Makefile should also regenerate some code so I can more easily see the resulting generated code?

roboll commented 8 years ago

@awalterschulze sure, just ran make regenerate and pushed the commit up here. It had a fairly large diff most of which is not actually related to this change - but you should be able to get an idea of what the resulting code looks like.

Also - what are your thoughts on testing this? I see there's some non-standard test directories to test the proto generation etc. - would you like me to create an additional test directory to test the handlers?

awalterschulze commented 8 years ago

I see what you mean. I should make another update diff before we merge this.

Could we have the Serve function use one of your newly generated functions?

roboll commented 8 years ago

@awalterschulze yeah, we can do that. I'll push something up later today with the change.

awalterschulze commented 8 years ago

There is a NewHandler function now. Maybe you'll find this useful.

Closing due to inactivity. Please open about if you need more.