absolute-url

Attaches .absoluteUrl() function to req

Stats

StarsIssuesVersionUpdatedCreatedSize
absolute-url
001.2.24 years ago6 years agoMinified + gzip package size for absolute-url in KB

Readme

absolute-url

Attaches .absoluteUrl() function to req.

Usage

// load module
var absoluteUrl = require('absolute-url')

// add routing
app.use(absoluteUrl())

// use it in your middleware
app.use(function (req, res, next) {
  console.log(req.absoluteUrl())
})

Attaching

If you don't know if absolute-url is used as middleware, it's possible to attach it dynamically. That is usefull inside of a middleware where you want to use an application specific instance (with options) or the default one.

app.use(function (req, res, next) {
  absoluteUrl.attach(req)

  console.log(req.absoluteUrl())
})

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.