apeman-app-fetch
apeman app to fetch data from another api.
Define res.fetch() method to send another request with HTTP GET method.
Installation
$ npm install apeman-app-fetch --save
Usage
- Define an app within Apemanfile.js
- Call the app via apeman app command.
Apemanfile.js
/** This is an example Apemanfile to use apeman-app-fetch */
'use strict'
module.exports = {
$pkg: { /* ... */ },
$apps: {
// Define your own app.
'my-app-01': {
// Map url and handlers.
'/': [
require('apeman-app-fetch')('http://localhsot:3001', {}),
(req, res, next) => {
req.fetch('/dos/1', ((data) => {
/* ... */
next()
}))
}
]
}
}
}
Then,
$ apeman app my-app-01 -p 3000
Signature
apemanAppFetch(options) -> function
apeman app to fetch data from another api.
Args
Name | Type | Default | Description |
---|---|---|---|
options | object | Optional settings. |
License
This software is released under the MIT License.