Get the full request URL in Express applications
npm install requested-url
const fullUrl = require('requested-url');
import fullUrl from 'requested-url';
const express = require('express');
const fullUrl = reqiure('requested-url');
cosnt app = express();
app.get('/posts/by/:userId', (req, res) => {
console.log(fullUrl(req));
// => https://example.com/posts/by/70122?h=true
// ...
// ...
});
Type: object
Express request object representing the HTTP request.
Type: string
The full request URL including the protocol, host, port, path, and query string.
npm install
npm test
MIT © Zsolt Meszaros