1.2.5 • Published 8 years ago

version-control v1.2.5

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

version-control

Build Status

A nodejs middleware for client version controlling

It forces a custom header to be sent from the client in order to allow a call to pass through this middleware

header must be sent in the form of:

x-app-version : [PLATFORM]/[VERSION_NUMBER]

How to use

install middleware

npm install --save version-control

sample code

var restify = require('restify');
var server = restify.createServer({
        name: 'test-server'
    });

var versionCheck = require('version-control')();
server.use(versionCheck);
server.listen(3000, function(){
    console.log('listening on port 3000');
});

Settings

you can also provide custom settings

var options = {
    "header" : "x-app-version",
    "platforms" : {
        "all" : {
            "link": "http://test.link",
            "1.0" : true
        }
    },
    "public" : [],
    "installPath" : "/install",
    "versionPath" : "/version",
    "errorStatusCode" : 400
 }

var versionCheck = require('version-control')(options);
  • header: header that is required to be included
  • platforms: object that allows you to setup valid platforms and valid versions
  • public: array of string with public paths that must to be ignored by version-control (use * as a wildcard)
  • installPath: (default empty) base path that tells version-control to redirect to the latest install link for platform (e.g. an installPath of "/install" makes a call to "/install/all" point to "http://test.link" with the example settings)
  • versionPath: (default "/version") base path that allows a client to check if its version is allowed
  • errorStatusCode: (default "400") status code returned for invalid version codes
1.2.5

8 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.8

9 years ago

1.1.7

9 years ago

1.1.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago