
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
absolute-url
Advanced tools
Get the absolute URL of an Express request object.
npm install --save absolute-url
The library offers two ways to use the functionality:
The default export is a function that can be called with the Express request object as a parameter.
It returns the absolute URL as a URL
object.
import absoluteUrl from 'absolute-url'
app.use((req, res, next) => {
console.log(absoluteUrl(req))
next()
})
See examples/function.js
for a full working example.
The package also exports a middleware
factory function.
It can be used to attach a .absoluteUrl
method to the Express request object.
The method returns the absolute URL as a URL
object.
import { middleware } from 'absolute-url'
app.use(middleware())
app.use((req, res, next) => {
console.log(req.absoluteUrl())
next()
})
See examples/middleware.js
for a full working example.
FAQs
Get the absolute URL of an Express request
We found that absolute-url demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.