1.0.15 • Published 7 years ago

sugo-demo-endpoint v1.0.15

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

sugo-demo-endpoint

Build Status npm Version JS Standard

Demo of sugo endpoint

Requirements

Installation

$ npm install sugo-demo-endpoint --save

Usage

Create an instance and apply to sg-server (or sugo-cloud)

/** This is an example to use sugo-demo-endpoint */

'use strict'

const sgServer = require('sg-server')

const server = sgServer({
  middlewares: [
    /* ... */
  ],
  endpoints: {
    '/foo/bar': require('sugo-demo-endpoint')({
      // Options
    })
  }
})

server.listen(3000)

Then call the api from agent script.

/** This is example of client */

'use strict'

const sugoAgentBase = require('sugo-agent-base')
const co = require('co')

co(function * () {
  let agent = sugoAgentBase('/foo/bar')
  let knocked = yield agent.knock()
  /* .. */
}).catch((err) => console.error(err))

Signature

sugoDemoEndpoint(options) -> function

Demo of sugo endpoint

Args
NameTypeDefaultDescription
optionsobjectOptional settings.

License

This software is released under the Apache-2.0 License.

Links