all files / express-stormpath/lib/helpers/ spa-response-handler.js

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15                       
'use strict';
 
/**
 * Returns an Express-compatible middleware function that will serve the SPA
 * root file, as defined by the configuration.
 *
 * @param  {Object} stormpathConfig Stormpath config object
 * @return {Function} spaResponseHandler Middleware function that writes the SPA
 * response from the configured file.
 */
module.exports = function spaResponseHandler(stormpathConfig) {
  return function spaResponseHandlerMiddleware(req, res) {
    res.sendFile(stormpathConfig.web.spa.view);
  };
};