News for hackers. Stuff that matters.
Re:Goji: a web microframework for Go by johne20 on Tuesday April 22, 2014 @05:32PM (#7630607)
"even if you're using something like Angular and a "single-page" type architecture; you pay a huge price in flexibility for it" Can you elaborate more on that statement? I use angular/golang api and rails/angular both often.
Re:Goji: a web microframework for Go by tptacek on Tuesday April 22, 2014 @05:38PM (#7630642)
I find the HTML templating options for Golang particularly painful, is the subtext there.

(I like Golang a lot; we did the bulk of microcorruption.com in it. But the web front end, which is a tiny amount of code, that's a Rails app.)

Re:Goji: a web microframework for Go by kisielk on Wednesday April 23, 2014 @06:06AM (#7633075)
When I wrote a single-page Angular app with a Go backend, we barely did any of the HTML generation on the Go side, basically just enough for AngularJS to take over, which was essentially just one index.html template. I found it worked really well as an AngularJS backend.

I previously did a multi-page using html/template and I found it a bit more painful, especially since at the time there wasn't a ready-to-use solution for dynamic template compilation during development and then static compilation in production. I'm not sure if there is now, but I haven't looked in quite some time.

As for the template html/template language itself I've kind of grown to like it, but maybe that's just me ;)

Re:Goji: a web microframework for Go by wilsonfiifi on Wednesday April 23, 2014 @05:54AM (#7633046)
One solution might be to include a javascript runtime in your app such as monkey (https://github.com/idada/monkey) , load a javascript template framework like underscore.js(http://underscorejs.org/) into the runtime context and create a render function that takes a JSON string and template string as parameters. You can then write the return value back into your "http response".

It's a bit of a hack/convoluted solution but it allows you to make use of a few javascript template libraries which are IMHO more pleasant to work with.

Re:Goji: a web microframework for Go by johne20 on Tuesday April 22, 2014 @05:59PM (#7630764)
Ahh thanks. Yeah, almost all of the apps I have written lately are a rest/json api service in rails or golang (martini) and the client side code is angular, ios, etc. So I don't care nor use html templating in go.
Re:Goji: a web microframework for Go by shiloa on Wednesday April 23, 2014 @02:18AM (#7632450)
What did you use for your db backend with Go? Gorp, beedb, database/sql, other? Just curious, as I've been looking at building some api's with go and martini lately.