Can we embed a web framework into Caddy?

I’m using Lapis (a Lua language web framework) which running on OpenResty server. Can we do the same thing with Caddy? Eg I want to embed Echo/Gin framework into Caddy to achieve some custom logic when matching HTTP routes.

The possibilities are endless, really.

For matching, we have the expression matcher, which uses CEL, a simple embedded language. You could do something similar with the language of your choice.

Do you have any specific questions?

Is there any sample demonstrating how to integrate a web framework into Caddy? I want to build some custom logic eg aggregate result from multiple API.

Not that I’m aware of. You can take a look at the plugins listed on the Caddy download page and read their source to get some ideas.