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
- Host: GitHub
- URL: https://github.com/firstandthird/hapi-method-routes
- Owner: firstandthird
- Created: 2015-10-12T15:16:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-25T15:52:09.000Z (almost 9 years ago)
- Last Synced: 2025-05-31T23:54:39.028Z (9 months ago)
- Topics: hapi-plugin, needs-readme
- Language: JavaScript
- Size: 22.5 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
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.