README
apeman-app-flush
apeman app to handle flush messages.
Installation
$ npm install apeman-app-flush --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-flush */
'use strict'
const co = require('co')
module.exports = {
$pkg: { /* ... */ },
$apps: {
'my-app-01': {
'/': [
// flush middleware needs session store.
require('apeman-app-session')({
/* ... */
}),
// Add flush
require('apeman-app-flush')({}),
co.wrap(function * (ctx, next) {
// Push flush message.
ctx.flush('Say hey!')
/* ... */
yield next()
}),
(ctx) => {
// Shift flush message.
let msg = ctx.flush()
/* ... */
}
]
}
}
}
Then,
$ apeman app my-app-01 -p 3000
Signature
apemanAppFlush(options) -> function
apeman app to handle flush messages.
Args
Name | Type | Default | Description |
---|---|---|---|
options | object | Optional settings. |
License
This software is released under the MIT License.