Files
talk/src/core/server/app/url.ts
T
2018-07-05 15:58:19 -06:00

13 lines
332 B
TypeScript

import { Request } from "talk-server/types/express";
import { URL } from "url";
export function reconstructURL(req: Request, path: string = "/"): string {
const scheme = req.secure ? "https" : "http";
const host = req.get("host");
const base = `${scheme}://${host}`;
const url = new URL(path, base);
return url.href;
}