rjweb-server
Version:
Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS
65 lines (64 loc) • 1.45 kB
TypeScript
import { HTTPMethods } from "..";
/**
* A Utility to wrap a parsed URL
* @example
* ```
* const url = new URLObject(...)
* ```
* @since 5.6.0
*/ export default class URLObject {
/**
* Create a new URL object for an easy Wrapper of `url.parse()`
* @since 5.6.0
*/ constructor(url: string, method: string);
/**
* The Request Method of the URL
* @example
* ```
* // POST https://example.com/lol/post
*
* url.method // "POST"
* ```
* @since 5.6.0
*/ readonly method: HTTPMethods;
/**
* The full URL
* @example
* ```
* // URL is https://example.com/lol/ok?ok=124#yes=ok
*
* url.href // "/lol/ok?ok=124#yes=ok"
* ```
* @since 5.6.0
*/ readonly href: string;
/**
* The Path of the URL
* @example
* ```
* // URL is https://example.com/lol/ok
*
* url.path // "/lol/ok"
* ```
* @since 5.6.0
*/ readonly path: string;
/**
* The Query of the URL
* @example
* ```
* // URL is https://example.com/lol/e?ok=123&test=567
*
* url.query // "e=123&test=567"
* ```
* @since 5.6.0
*/ readonly query: string;
/**
* The Fragments of the URL
* @example
* ```
* // URL is https://example.com/lol/ok#u=123&test=567
*
* url.fragments // "u=123&test=567"
* ```
* @since 5.6.0
*/ readonly fragments: string;
}