ExpressJS middleware to fetch the current (or specified) revision of your Ember App from Azure Tables deployed by ember-cli-deploy.
Looking for an Ember CLI addon to enable deployment to Azure? Check out the excellent ember-deploy-azure addon by duizendnegen!
This is a modified version of Ben Limmer's excellent node-ember-cli-deploy-redis package. Thanks, Ben!
npm install node-ember-cli-deploy-azure-tables
There are two ways of using the package:
require
the packageuse
the 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'));
require
the package- Use the
fetchIndex
method - Render the index string as you wish.
var express = require('express');
var app = express();
var fetchIndex = require('node-ember-cli-deploy-azure-tables/fetch');
app.get('/', function(req, res) {
fetchIndex(req, 'myapp', {
accountName: 'AZURE_STORAGE_ACCOUNT_NAME',
accessKey: 'AZURE_STORAGE_ACCESS_KEY'
}).then(function (indexHtml) {
indexHtml = serverVarInjectHelper.injectServerVariables(indexHtml, req);
res.status(200).send(indexHtml);
}).catch(function(err) {
res.status(500).send('Oh noes!\n' + err.message);
});
});
You can fetch a specific revision by using the index_key
query param. Example:
http://www.coolio.com?index_key=abc123
Comments/PRs/Issues are welcome!