Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 439 Bytes

README.md

File metadata and controls

18 lines (16 loc) · 439 Bytes

#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.