Integrate Hugo with dynamically created http.HandleFunc content

I currently have a wordpress site serving ordinary static blog-type content. I am well on the way to recreating that with Hugo. I also have a weather reporting site backended with MySql, using go with http.HandleFunc to serve out quite complex svg pages in real time.

How should I go about combining the two? I want to show the dynamic content as a page of the hugo site.

Running the http.HandleFunc site on a non-standard port won’t work because some of the clients are behind firewalls that only allow port 80.

I am not after a fully worked out solution, just pointing in a direction to try.

Set up a web server like Apache that can do CGI to serve your weather pages. Use the CGI to call your go application.

Set up a process to push the pages that Hugo builds to your Apache server. Let Apache serve those pages.

@michael_henderson that sounds a little bit too complex.

Have a look at https://golang.org/pkg/net/http/#ServeMux

It is pretty straight forward to mix static and dynamic handlers.

I am getting away from Apache, as being too heavyweight. I can serve fastCGI very economically (in CPU terms) directly with go. This much is done and working well.

1 Like

Ah, yes. So I could just use another handler to serve the hugo-generated static pages. I think that may have been the insight I was looking for. Thanks @bep