3.0.1 • Published 8 years ago

apeman-app-link v3.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

apeman-app-link

Build Status Code Climate Code Coverage npm Version JS Standard

apeman app to parse links for jsonapi.

Installation

$ npm install apeman-app-link --save

Usage

  1. Define an app within Apemanfile.js
  2. 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
NameTypeDefaultDescription
optionsobjectOptional settings.
options.protocolstringhttpLink protocol.
options.hoststringHost setting.
options.pathnamestringBase pathname.

License

This software is released under the MIT License.

Links

3.0.1

8 years ago

3.0.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago