Simple:json-routes: How to avoid showing app details in REST error message?


I am using simple:json-routes to implement a REST API which accepts a Content-Type: application/json POST request.

My issue is that when the incoming request has badly formatted JSON, I get a traceback in the body of the error message:

SyntaxError: Unexpected token ]
    at Object.parse (native)
    at /home/sysop/.meteor/packages/simple_json-routes/.
    at IncomingMessage.onEnd (/home/sysop/.meteor/packages/simple_json-routes/.
    at IncomingMessage.g (events.js:180:16)
    at IncomingMessage.emit (events.js:92:17)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

I would prefer not to expose this, but this is happening before I get into my code in the JsonRoutes.add() callback.

How can I get rid of this and just return the 400 Bad Request status?


please refer this post for the best way for creating REST api’s in meteor .