mirror of
https://github.com/wassname/talk.git
synced 2026-07-08 22:23:44 +08:00
13 lines
332 B
TypeScript
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;
|
|
}
|