14 lines
370 B
TypeScript
14 lines
370 B
TypeScript
import { Request } from "express";
|
|
|
|
export function addDays(date: Date, days: number): Date {
|
|
var result = new Date(date);
|
|
result.setDate(result.getDate() + days);
|
|
return result;
|
|
}
|
|
|
|
export function getConnectingIp(req: Request): string {
|
|
return (req.headers["cf-connecting-ip"] ||
|
|
req.headers["X-Forwarded-For"] ||
|
|
req.socket.remoteAddress) as string;
|
|
}
|