(function() {
  var _, pkg, runner, send;

  _ = require("lodash");

  send = require("send");

  runner = require("@packages/runner");

  pkg = require("@packages/root");

  module.exports = {
    serve: function(req, res, config, getRemoteState) {
      config = _.clone(config);
      config.remote = getRemoteState();
      config.version = pkg.version;
      return res.render(runner.getPathToIndex(), {
        config: JSON.stringify(config),
        projectName: config.projectName
      });
    },
    handle: function(req, res) {
      var pathToFile;
      pathToFile = runner.getPathToDist(req.params[0]);
      return send(req, pathToFile).pipe(res);
    }
  };

}).call(this);
