node.js - Handle 404 Error with resource -
node.js - Handle 404 Error with resource -
i have next middleware protect get-route.
function isadmin(req, res, next) { if(req.user.role == "admin") { homecoming next(); } homecoming res.send(404); }
is way send error correct?
and api call:
$scope.users = apiservice.query({ route:'users' });
how, can grab 404 , stuff?
thanks!
...so, there's ton of stuff out there turns on search engines.
that said, seek quick prepare points in 1 direction can take:
function isadmin(req, res, next) { if(req.user.role == "admin") { homecoming next(); } res.status(404).send('you need admin see page'); }
there's stuff on handling 404's at:
the official express docs onres.status
how programmatically send 404 response express/node? error handling examples express github page the lastly 1 provides examples on handling error while rendering template.
node.js angularjs
Comments
Post a Comment