Versioning is implemented as a plugin that users can opt into so that there is a simple on-ramp without a bunch of boilerplate.
A use would start with the simplest possible code for a service.
Sometime in the future, a use decide that they want to change a version of the service but leave the old instance in tact until they can modify all the rest of their services.
// Now you introduce ServiceVersions as plugin
Studio.use(ServiceVersions);
// Legacy service
Studio(function serviceA() {
return Math.random();
}).version('0.0.0');
// New and improved service
Studio(function serviceA() {
return Math.random() + 1;
}).version('~2.0.0');
// Reference a service by version in newer services
var serviceA = Studio('serviceA').version("2.0.0");
The Studiojs router automatically prepends each route with a version number (defaulted to 0.0.0 in case the ServiceVersion plugin is not used).
Therefore, no versions means all routes work exactly the same way but assume all versions are 0.0.0 When the versions plugin is used, the user would opt individual call sites with an upgraded version (based on SemVer).
This could work in a mixed environment (e.g. in a Studio-cluster) as well.
We should support different versions of services following the spec suggested by @avishnyak
.............................................................................SPEC............................................................................
Versioning is implemented as a plugin that users can opt into so that there is a simple on-ramp without a bunch of boilerplate. A use would start with the simplest possible code for a service.
Sometime in the future, a use decide that they want to change a version of the service but leave the old instance in tact until they can modify all the rest of their services.
The Studiojs router automatically prepends each route with a version number (defaulted to 0.0.0 in case the ServiceVersion plugin is not used). Therefore, no versions means all routes work exactly the same way but assume all versions are 0.0.0 When the versions plugin is used, the user would opt individual call sites with an upgraded version (based on SemVer). This could work in a mixed environment (e.g. in a Studio-cluster) as well.