gpt4 book ai didi

javascript - 如何处理服务器( Node js)中表单的数据?

转载 作者:行者123 更新时间:2023-11-29 21:26:09 24 4
gpt4 key购买 nike

<分区>

我有一个网站,其中有一个部分允许用户登录。一旦用户输入了他们的详细信息并单击“登录”,我将如何从服务器请求中获取该信息进行处理?我知道“get”方法,但是,每当我使用它时,表单中的所有值都会显示在 URL 中(包括密码)。

这是处理请求的服务器文件中的函数

function handle(request, response) {
var url = request.url;
url = removeQuery(url);
url = lower(url);
url = addIndex(url);

var querystring = require('querystring');
var params = querystring.parse(require('url').parse(request.url).query);

if (! valid(url)) return fail(response, NotFound, "Invalid URL");
if (! safe(url)) return fail(response, NotFound, "Unsafe URL");
if (! open(url)) return fail(response, NotFound, "URL has been banned");

var type = findType(url);
if (type == null) return fail(response, BadType, "File type unsupported");
if (type == "text/html") type = negotiate(request.headers.accept);
reply(response, url, type);
}

基本上,如何从表单中获取信息而不在 URL 中显示信息?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com