0.1.0 • Published 6 years ago

requested-url v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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