remoteAddr

remoteAddr

ctx对象的remoteAddr属性用于获取请求的远程地址。

示例

import {HttpServer} from "http";

let server = new HttpServer({
	addr: ":8090",
});

server.any("/test", (ctx) => {
	console.log("远程地址:", ctx.remoteAddr);
});

server.start();
更新时间 12/31/2024, 5:31:44 PM