Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Render conditionally JSON or JSONP in Dyson
function renderJsonp(res, callback) {
res.append('Content-Type', 'application/javascript');
res.send(callback + '(' + JSON.stringify(res.body) + ');');
function renderJson(res) {
function render(req, res) {
var callback = req.query.callback;
if (callback) renderJsonp(res, callback);
else renderJson(res);
module.exports = {
path: '/api/v3/athlete/activities',
template: {
// ...
render: render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.