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

Torben Hoffmann <>
Mon Mar 7 08:49:31 CET 2016


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


More information about the erlang-questions mailing list