An open API service indexing awesome lists of open source software.

https://github.com/firstandthird/hapi-method-routes

Hapi plugin to expose server methods via routes
https://github.com/firstandthird/hapi-method-routes

hapi-plugin needs-readme

Last synced: 5 months ago
JSON representation

Hapi plugin to expose server methods via routes

Awesome Lists containing this project

README

          

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

## Example:
```js
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.