We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to make a 404 error pretty. Problem is that I cannot seem to hook the error properly. This code demonstrates the problem:
// Generated by CoffeeScript 1.6.3 (function() { var Hapi, app_root_dir, get, is_production, options, path, routes, server, server_root_dir; Hapi = require('hapi'); path = require('path'); is_production = function() { return process.env.NODE_ENV === 'production'; }; server_root_dir = path.resolve('./'); app_root_dir = path.join(server_root_dir, 'app'); options = { cors: { origin: ['*'] }, debug: is_production() ? false : { request: ['error', 'uncaught'] } }; server = new Hapi.Server('localhost', (is_production() ? 80 : 8080), options); server.ext('onPreResponse', function(request, next) { var response; response = request._response; if (!response.isBoom) { return next(); } return next({ a_pretty_json: 'well not really' }); }); get = function(path, config) { return { path: path, method: 'GET', config: config }; }; routes = [ get('/', { handler: function(request) { return request.reply({ hello: 'world' }); } }), get('/{path*}', { handler: { directory: { path: app_root_dir, listing: false, index: true } } }) ]; server.route(routes); server.start(); }).call(this);
The text was updated successfully, but these errors were encountered:
dc492f9
Apply response prepare before calling onPreResponse. Closes hapijs#1182
a970983
hapijs#1155
hueniverse
No branches or pull requests
I want to make a 404 error pretty. Problem is that I cannot seem to hook the error properly. This code demonstrates the problem:
The text was updated successfully, but these errors were encountered: