README
apeman-app-link
apeman app to parse links for jsonapi.
Installation
$ npm install apeman-app-link --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-link */
'use strict'
const co = require('co')
module.exports = {
$pkg: { /* ... */ },
$apps: {
// Define your own app.
'my-app-01': {
// Map url and handlers.
'/': [
require('apeman-app-link')({
// Options
protocol: 'https',
host: 'hoge.example.com'
}),
co.wrap(function * handler01 (ctx, next) {
let link = ctx.link('/api/hoo/bar?page=1') // Resolve relative link to full path.
/* ... */
})
]
}
}
}
Then,
$ apeman app my-app-01 -p 3000
Signature
apemanAppLink(options) -> function
Resolve link url.
Args
Name | Type | Default | Description |
---|---|---|---|
options | object | Optional settings. | |
options.protocol | string | http | Link protocol. |
options.host | string | Host setting. | |
options.pathname | string | Base pathname. |
License
This software is released under the MIT License.