10 lines
271 B
TypeScript
10 lines
271 B
TypeScript
![]() |
import { Middleware } from "retes";
|
||
|
|
||
|
export const withBaseURL: Middleware = (handler) => async (request) => {
|
||
|
const { host, "x-forwarded-proto": protocol = "http" } = request.headers;
|
||
|
|
||
|
request.context.baseURL = `${protocol}://${host}`;
|
||
|
|
||
|
return handler(request);
|
||
|
};
|