Skip to content

Instantly share code, notes, and snippets.

@matthewhudson
Created November 17, 2013 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewhudson/7519861 to your computer and use it in GitHub Desktop.
Save matthewhudson/7519861 to your computer and use it in GitHub Desktop.
Sends anything from request back as JSON
# Sends anything from request back as JSON
exports.pong = (req, res) ->
# Create ping-pong response from received data
data =
pongQuery: req.query
pongBody: req.body
pongParams: req.params
pongCookies: req.cookies
id: req.params.id
controller: req.params.controller
method: req.params.method
# Send response object as JSON
res.send data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment