[erlang-questions] Code structure for webmachine/cowboy with versioned API

Heinz Nikolaus Gies heinz@REDACTED
Tue Mar 8 01:48:39 CET 2016


In FiFo’s API I am dispatching in the code, for me between versions there is a lot of similarity (as in 95% of the code stays the same but there is 5% breakage) so with dispatching in the code I can prevent douplication form code. The downside here is that it’s easy to mess something up or forget to remove code when a version is deprecated.
> On Mar 7, 2016, at 2:49, Torben Hoffmann <thoffmann@REDACTED> wrote:
> 
> Hi,
> 
> I am working a HTTP API that has a version in it, like this:
> /api/1/...
> 
> Should I create separate handler modules for each version?
> Or should I have code that branches out on the api version in one common
> handler module?
> 
> If I dispatch to a version specific handler module I will not have to
> think about the version anymore.
> 
> If I dispatch to a version generic handle module I can - potentially -
> reuse code that is common across api versions.
> 
> I'm pretty sure there will be new api versions - this is not just a case
> of being a good citizen. The current version of the software is young,
> so I would not say it is in any way cast in stone yet.
> 
> I'm inclined to do version specific handler modules because it makes the
> modules very clean in terms of contex. But I am not an expert on
> webmachine/cowboy, so I thought I would ask.
> 
> Cheers,
> Torben
> --
> Torben Hoffmann
> Architect, basho.com
> M: +45 25 14 05 38
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160307/3636fe9c/attachment.bin>


More information about the erlang-questions mailing list