💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
(1)response.redirect方法 response.redirect方法允许网址的重定向。 ~~~ response.redirect("/hello/anime"); response.redirect("http://www.example.com"); response.redirect(301, "http://www.example.com"); ~~~ (2)response.sendFile方法 response.sendFile方法用于发送文件。 ~~~ response.sendFile("/path/to/anime.mp4"); ~~~ (3)response.render方法 response.render方法用于渲染网页模板。 ~~~ app.get("/", function(request, response) { response.render("index", { message: "Hello World" }); }); ~~~ 上面代码使用render方法,将message变量传入index模板,渲染成HTML网页。