express-noticeboard
v0.0.3
Published
cjs-noticeboard as express middleware
Downloads
5
Readme
express-noticeboard
Simple wrapper that turns cjs-noticeboard into express middleware
Install
npm install express-noticeboard
Create Noticeboard
var express = require('express')(),
noticeboard = require('express-noticeboard')( noticeboard_configs );
express.use( noticeboard );
Use Existing Noticeboard
var express = require('express')(),
Noticeboard = require('cjs-noticeboard'),
noticeboard = new Noticeboard( noticeboard_configs );
express.use( require('express-noticeboard')({ noticeboard: noticeboard }) );
Send or watch notices from inside your routes
express.post( '/user', function( req, res ){
// after creating user
req.noticeboard.notify( 'user-created', user );
});
Send or watch notices from outside your routes
express.post( '/user', function( req, res ){
// after creating user
req.noticeboard.notify( 'user-created', user );
});
noticeboard.watch( 'user-created', 'send-welcome-email', function(){
// send welcome email to user
});
noticeboard.watch( 'user-created', 'remove-user-from-marketing-funnel', function(){
// remove user from marketing funnel
});