Currently, I'm trying to understand the workings of express and have come up with this get method:
app.get('/myendpoint', function(req, res) {
var js = JSON.parse ({code: 'success', message:'Valid'});
res.status(200).json(js);
});
However, whenever this endpoint is triggered, an error occurs:
_http_server.js:192
throw new RangeError(`Invalid status code: ${statusCode}`);
Interestingly, if I disable the JSON.parse statement and use valid json instead of "js", there are no issues at all. How would you suggest resolving this problem?