hapi-method-routes

1.0.1 • Public • Published

hapi-method-routes is a plugin that exposes server methods as routes

Example:

server.method('add', (a, b, done) => done(null, a.toString() + b.toString()), {});
server.inject({
  url: '/methods',
  method: 'POST',
  payload: {
    method: 'add(20, 25)'
  }
}, response => {
  console.log(response.result.successful);
  console.log(response.result.result);
});

will print 'true' and '2025'. See tests for more examples.

/hapi-method-routes/

    Package Sidebar

    Install

    npm i hapi-method-routes

    Weekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • jga
    • dawnerd
    • ecwillis
    • orthagonal1
    • alaguna
    • aleperez92