Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support services version on studio #53

Open
ericholiveira opened this issue May 23, 2016 · 0 comments
Open

Support services version on studio #53

ericholiveira opened this issue May 23, 2016 · 0 comments

Comments

@ericholiveira
Copy link
Owner

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.

Studio(function serviceA() {
  return Math.random();
});


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant