Skip to content

Express response.location

TIP

将响应 Location HTTP 标头设置为指定的 path 参数。

Express
res.location(path)

设置location 请求头.

Express
res.location('/foo/bar');
res.location('foo/bar');
res.location('http://example.com');
res.location('../login');
res.location('back');

如果你的程序根地址是/blog, 下面的代码会把 location 请求头设置为/blog/admin:

Express
res.location('admin')