How can I send a response that is a block of code in a node request response function?

I am trying to have a server side function return a block of code. For example, I want to send the following back after a request:

$('body').css('background-color', 'blue')

What I did was wrap this in quotes and have the following response:

res.end("$('body').css('background-color', 'blue')");

However, as I write many lines code, I want to be able to write it without quotation marks. How can I store many lines of code in one variable perhaps so that I can write res.end(codesnippet)?

You can escape new lines with a backslash \. So you would end each line like this:

var codesnippet = "$('body').css('background-color', 'blue')\
                            .css('margin', '10px');"

Sounds like you want to create an API: See https://github.com/awatson1978/rest-api

Also look at iron:router server side routes for the basics.