ftfy

1.0.1 • Public • Published

node-ftfy

Suggest a URL when someone enters a typo on your Restify server

Get it

npm i ftfy -SE

Test it

git clone https://github.com/jameswomack/node-ftfy.git
cd node-ftfy
npm i
npm test

Example Usage

var FTFY = require('ftfy')
var server = Restify.createServer()

server.get('/the-president', handler)

server.listen(PORT, function () {
  FTFY.mountTo(server)
})

request
  .get('/teh-president')
  .end(function (err, res) {
    // res.body -> 'Did you mean /the-president ?'
  });

// Default no match message
request
  .get('/8dfhaoyd0a98j')
  .end(function (err, res) {
    // res.body -> 'Url not found'
  });

// Custom no match message
FTFY.NO_MATCH_MESSAGE = 'Whooooooops'
request
  .get('/8dfhaoyd0a98j')
  .end(function (err, res) {
    // res.body -> 'Whooooooops'
  });

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    3
  • 1.0.0
    0

Package Sidebar

Install

npm i ftfy

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jameswomack