Hacker News new | past | comments | ask | show | jobs | submit login

Oh wow someone finally went ahead with the server rendered js in Go ! Looks great. I have been experimenting various ways to build web apps in Go: https://github.com/adnaan/gomodest-template. I have landed on pursuing one approach more deeply: server rendered html templates over websockets. Don’t have a lot of documentation right now but here are some examples: https://github.com/goliveview/examples.



Love seeing people experimenting in this space with Go! One of my favorite things about this HN post is everyone is coming out of the woodworks to share their ideas.

What's the advantage of rendering HTML templates over websockets? Is this similar to Hotwire where it sends you HTML fragments over websockets when you, for example, click on a button?


Like you said in another thread, there are two choices here. I took the other choice because I wanted to: 1. not build a new templating language 2. not maintain a custom server side renderer(v8). 3. Keep javascript to the minimum 4. Build for developers who know Go and maybe a little html/css. 5. No special html attributes. It should be just standard html/template i.e easy to delete the websocket stuff if it doesn’t work for you 6. Offer a view library instead of a framework. Go users are likely to be more open to adopting a library.

The approach is similar to hotwire except I only use stimulusjs and not use turbojs. turbojs doesn’t integrate well with html/template. In my approach, you can simply reuse the html templates you have already written with standard html/template package.

Sorry for the rambling, I haven’t gotten around to writing down all of it in a more structured way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: