title: Compile coffeescript in eval
body: <p>I have a node.js website where I pass javascript in the query string.</p>
  
  <p>Then I eval the javascript in the request handler. (Not secure, I know.)</p>
  
  <pre><code>// web.js
  var express = require("express");
  var logfmt = require("logfmt");
  var app = express();
  
  app.use(logfmt.requestLogger());
  
  app.get('/', function(req, res) {
    var code = req.query.code;
    var result = eval("(function(req, res) {" + code + "})(req, res);");
    res.send('Result: ' + result);
  });
  
  var port = process.env.PORT || 5000;
  app.listen(port, function() {
    console.log("Listening on " + port);
  });
  </code></pre>
  
  <p>I want to be able to pass coffeescript into the query string and have it be evaluated, <strong>but</strong> I don't want to change the node.js code <strong>at all</strong>. So I would need to wrap something around the coffeescript to turn it into javascript at eval time, doing the <strong>compilation and execution</strong> of the resulting javascript <strong>fully within the eval</strong>.</p>
  
  <p>Is this possible?</p>
  
  <p><strong>Clarification</strong>: I don't want the source of the coffeescript compiler to exist on disk on my web server at all. (e.g. extras/coffee-script.js) I want to pass the source of the coffeescript compiler <strong>into</strong> the eval block, so the compilation itself is done without any dependencies. Then I want to execute the resulting javascript. </p>
  
  <p>The coffeescript compiler probably won't fit into a query param, so conceptually it could be passed via POST body or otherwise.</p>