ddns-updater icon indicating copy to clipboard operation
ddns-updater copied to clipboard

Feature request: API HTTP server

Open qdm12 opened this issue 5 years ago • 5 comments

  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?

qdm12 avatar May 31 '20 00:05 qdm12

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?

fredericrous avatar Jan 27 '21 17:01 fredericrous

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 😄

qdm12 avatar Jan 28 '21 00:01 qdm12

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

fredericrous avatar Jan 28 '21 02:01 fredericrous

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.

qdm12 avatar Jan 28 '21 04:01 qdm12