Created
May 10, 2013 15:16
-
-
Save muhammadghazali/5555076 to your computer and use it in GitHub Desktop.
Indent size preference on my JavaScript source code. I preferred to choose indent size with 2 spaces.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A middleware to check the requested content type. | |
*/ | |
module.exports.acceptedFormat = function () { | |
return function (req, res, next) { | |
res.format({ | |
'application/json': function () { | |
next(); | |
}, | |
'application/xml': function () { | |
next(); | |
}, | |
'default': function () { | |
res.send(406, 'Sorry, we only provide resources in JSON and XML.'); | |
} | |
}); | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A middleware to check the requested content type. | |
*/ | |
module.exports.acceptedFormat = function () { | |
return function (req, res, next) { | |
res.format({ | |
'application/json': function () { | |
next(); | |
}, | |
'application/xml': function () { | |
next(); | |
}, | |
'default': function () { | |
res.send(406, 'Sorry, we only provide resources in JSON and XML.'); | |
} | |
}); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment