1.0.1 • Published 8 years ago

connect-breadcrumb v1.0.1

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

connect-breadcrumb

breadcrumb middleware for express and connect

install

npm install --save connect-breadcrumb

usage

var express = require('express');
var breadcrumb = require('connect-breadcrumb');

var app = express();

// instantiate with default options: same as `app.use(breadcrumb());`
app.use(breadcrumb({
  home: '⌂',
  endingSlash: false,
  beautify: function(str) {
    return str.replace(/[-_]/g, ' ');
  },
  resAttribute: 'breadcrumb'
}));

app.use(function(req, res, next){
  // for middleware
  console.log('breadcrumb', res.breadcrumb) ;
  // same as res.breadcrumb for view templates
  console.log('breadcrumb', res.locals.breadcrumb)
});

options

the following optional options can be provided as {Object} (see usage above).

  • home {String}: name for the home link
  • endingSlash {Boolean}: true, if the url elements should contain the ending slash '/'
  • beautify {Function}: beautify function
  • resAttribute {String}: attribute name res[resAttribute] and res.locals[resAttribute]

license

MIT

author

Andi Neck | @andineck | andi.neck@intesso.com | intesso