requested-url

0.1.0 • Public • Published

Full Request URL Build Status

Get the full request URL in Express applications

Install

npm install requested-url

Import

Node

const fullUrl = require('requested-url');

ES6 import

import fullUrl from 'requested-url';

Usage

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

  // ...
  // ...
});

API

fullUrl(req)

req

Type: object

Express request object representing the HTTP request.

return

Type: string

The full request URL including the protocol, host, port, path, and query string.

Test

npm install
npm test

License

MIT © Zsolt Meszaros

Package Sidebar

Install

npm i requested-url

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

4.17 kB

Total Files

9

Last publish

Collaborators

  • zsoltime