var path = require('path');
var FastBootServer = require('ember-fastboot-server');
var outputPath = 'fastboot-dist';
var appName = 'bustle';

var server = new FastBootServer({
  distPath: 'fastboot-dist'
});

function insertIntoIndexHTML(res) {
  return server.insertIntoIndexHTML(res.title, res.body, res.head);
}

exports.handler = function(event, context) {
  server.app.visit(event.path, { request: { get: function() {} }, response: {} })
    .then(insertIntoIndexHTML)
    .then(context.succeed)
    .catch(context.fail);
};

var path = require('path');
var FastBootServer = require('ember-fastboot-server');
var outputPath = 'fastboot-dist';
var appName = 'bustle';

var server = new FastBootServer({
  distPath: 'fastboot-dist'
});

function insertIntoIndexHTML(res) {
  return server.insertIntoIndexHTML(res.title, res.body, res.head);
}

exports.handler = function(event, context) {
  server.app.visit(event.path, { request: { get: function() {} }, response: {} })
    .then(insertIntoIndexHTML)
    .then(context.succeed)
    .catch(function() {
      context.fail('AWS Lambda Error')
    });
};

throw explicit, generic error string from lambda function for use with API gateway