sugo-demo-endpoint
v1.0.15
Published
Demo of sugo endpoint
Downloads
1
Readme
sugo-demo-endpoint
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
| Name | Type | Default | Description | | --- | ---- | --- | --- | | options | object | | Optional settings. |
License
This software is released under the Apache-2.0 License.