2.0.0 • Published 10 years ago

hapi-as-promised v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

hapi-as-promised Build Status NPM version

A Hapi plugin that allows you to reply with promises in your request handlers.

Usage

server.route({
  method: 'GET'
  path: '/',
  handler: function (request, reply) {
    reply(promise);
  }
});

The plugin will automatically intercept all replies that are thenables (have a property then that is a function) and resolve them. You can still chain methods to your reply like code. Only the reply body itself is modified. Error behavior is unchanged. A rejection with err.isBoom === true will be serialized and sent to the client, while all others will be transformed into 500s.

2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago