Embedding Caddy v2 Web Server in Go

This thread was closed without a real outcome:

I would also be interested in a small guide.

On the other hand I would like to discuss, if this would be useful for my go application or if I should convert it into a plugin.

I would like to embed the caddy v2 webserver into my go backend application.

My application:

  • is a backend for a react frontent
  • has also hardware interaction
  • is shipped to run on a local PC or a small headless industry PC
  • has no interaction with the internet
  • frontend clients connect from the local PC or from the local network only

My idea would be that my application houses besides the backend also the webserver for the frontend.
Is that even desirable in these circumstances?

Since there’s documentation for it already, I’d recommend implementing it as a plugin first. Your code can be a Caddy app, which plugs into the Caddy lifecycle.

I’m not sure how the “Caddy as an embedded server” usecase looks as of v2. I think source-diving is your best option for the time being. The code is pretty well commented, so it shouldn’t be too difficult to figure out.

Let us know if you have any more specific questions!

1 Like

Thank you @francislavoie. The plugin documentation looks to be pretty good. I’ll read it and will decide if it makes sense for my project.

As for the source-diving… I’ll have to find some time. I’m still in the learning phase for GO, so I think it would take me a fair amount of time.

This topic was automatically closed after 30 days. New replies are no longer allowed.