[erlang-questions] Code structure for webmachine/cowboy with versioned API
Torben Hoffmann
thoffmann@REDACTED
Tue Mar 8 11:42:19 CET 2016
Heinz Nikolaus Gies <heinz@REDACTED> writes:
> [ text/plain ]
> 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.
That sounds very reasonable.
For now I have punted the issue to future me, so the amount of breakage
will decide for me what course to take.
Thanks,
Torben
>> 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
>
> [ signature.asc: application/pgp-signature ]
--
Torben Hoffmann
Architect, basho.com
M: +45 25 14 05 38
More information about the erlang-questions
mailing list