qdm12 / ddns-updater

Container to update DNS records periodically with WebUI for many DNS providers
https://hub.docker.com/r/qmcgaw/ddns-updater/
MIT License
1.62k stars 158 forks source link

Feature request: API HTTP server #75

Open qdm12 opened 4 years ago

qdm12 commented 4 years ago
  1. What's the feature?

Setup a simple HTTP server to serve information and modify settings

  1. Why do you need this feature?

Such that it can be used as an API consumed by the web ui react frontend

  1. Extra information?
fredericrous commented 3 years ago

I did a quick look online and the Iris framework seems to be a good choice for an API https://github.com/kataras/iris It is actively maintained, very few issues are opened, there are loads of up to date examples. It looks easy to use/implement. What do you think?

qdm12 commented 3 years ago

Ehh sorry to disappoint, but I'd like to stay away from frameworks. Especially we just need I think a GET, POST and PUT endpoints and call it a day 👍 I'm fine with adding a (good, idiomatic, close to the Go standard library) router like go-chi though.

I'm very used to write HTTP servers in Go, what I can do is lay some foundations and then you can fill it up? But that will probably have to wait until the weekend 😄

fredericrous commented 3 years ago

I was suggesting Iris because it looks super easy and readable from what I read from the section "Simple Handler" of their Readme.md . Also, I believe the go compiler removes unused code so using a framework shouldn't introduce too much heaviness. Anyway, I'm afraid to write an API in Go without structure, that's the main reason I suggested a framework. If you lay down some foundation I sure will be happy to help

qdm12 commented 3 years ago

Anyway, I'm afraid to write an API in Go without structure

Totally understandable. It took me a while to figure a good structure, and I constantly see oddities in how HTTP servers are implemented / non testable. So it is not trivial indeed 😄

Right now I'm in the middle of solving #136 and will get to the HTTP server right after.

jdevera commented 1 month ago

I came to suggest a similar feature. In my case, I would only need read support on such API. My goal is to show a summary in a Homepage widget so I can see if everything is fine or if something needs my attention.

Perhaps this could come as a first iteration before considering config changes 👼 .