hapijs - hapi catch all route without assets folder 404 status -


i'm working on spa , want manage 404 status without using separate folder (assets in case)

server.route(     {    // angular/api route         method: 'get',         path: '/api',         handler: function (request, reply) {              reply( {api: 'response' } )         }     });      server.route({    // other assets if have         method: 'get',         path: '/assets/{param*}',         handler: {         directory: {             path: './assets',             listing: false,             index: true         }     });      server.route({   // else          method: 'get',         path: '/{p*}',         handler: function (request, reply) {             reply.file('public/html/index.html');         }     }); 

i mean i've got deploy like

deploy

so if use assets i've change deploy , gulpfile.

is there way manage 404 status without using folder ?

update worked out following tip of @matt harrison

server.ext('onpreresponse', function (request, reply) {     var req = request.response;     if (req.isboom && (req.output.statuscode===404)) {       return reply.redirect('/#!/404');     }     return reply.continue(); }); 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -