ExpressJS middleware to fetch the current (or specified) revision of your Ember App from Azure Tables deployed by ember-cli-deploy.
ember-cli-deploy is great. It allows you to run
multiple versions in production at the same time and view revisions without impacting users.
However, the example provided uses koa
and many of us are not. This package allows you to easily fetch current and specified index.html
revisions from Azure Table storage.
Check out the excellent ember-cli-deploy-azure addon by duizendnegen!
npm install node-ember-cli-deploy-azure-tables
There are two ways of using the package:
- requirethe package
- usethe package in your app
var express = require('express');
var app = express();
var nodeEmberCliDeployAzureTables = require('node-ember-cli-deploy-azure-tables');
app.use('/*', nodeEmberCliDeployAzureTables({
  accountName: 'AZURE_STORAGE_ACCOUNT_NAME',
  accessKey: 'AZURE_STORAGE_ACCESS_KEY'
}, 'myapp'));You can  fetch a specific revision by using the index_key query param. Example:
http://www.coolio.com?index_key=abc123
- connectionInfo(object, required) - the configuration to connect to azure tables.- accountName(required) - azure storage account name
- accessKey(required) - azure storage account key
 
- keyPrefix(required) - the application name, specified for ember deploy
 the keys in azure tables are prefaced with this name. For instance, if your azure table keys are- my-app:index:current, you'd pass- my-app:index.
- options(optional) - a hash of params to override the defaults
- azureTableName(defaults to- emberdeploy) overrides the default table name from which to fetch
- revisionQueryParam(defaults to- index_key)
 the query parameter to specify a revision (e.g.- http://example.org/?index_key=abc123). the key will be automatically prefaced with your- keyPrefixfor security.
- memoize(defaults to- false) enable memoizing azure storage. see the memoization section for more details.
- memoizeOptscustomize memoization parameters. see the memoization section for more details.
Since the majority of the requests will be serving the current version of your
app, you can enable memoization to reduce the load on Azure Tables. By default, memoization
is disabled. To enable it, simply pass:
memoize: truein your options hash. Additionally, you can pass options to the underlying memoization library (memoizee). Check out their documentation, and the defaults for this library.
app.use('/*', nodeEmberCliDeployAzureTables({
  accountName: 'AZURE_STORAGE_ACCOUNT_NAME',
  accessKey: 'AZURE_STORAGE_ACCESS_KEY'
  },
  'myapp',
  { memoize: true },
));This is a modified version of Ben Limmer's excellent node-ember-cli-deploy-redis package. Thanks, Ben!
Comments/PRs/Issues are welcome!