url-utils
0.1.2 • Public • Published npm-url-utils
Node.js - An implementation of URLUtils as described by MDN. Useful for emulating window.location on the server side.
See MDN documentation: https://developer.mozilla.org/en-US/docs/Web/API/URLUtils
Example (using express.js)
app.get('*', function(req, res){
var URLUtils = require('url-utils');
var window = {
location: new URLUtils(
req.protocol + '://' + req.get('host') + req.originalUrl
)
};
console.log( window.location.href );
console.log( window.location.protocol );
console.log( window.location.hash );
});
Package Sidebar
Install
Weekly Downloads