Kam*_*ain 6 rest web-services http ssl-certificate node.js
我在我的项目中使用了 http 模块,但我的大部分“发布”请求都被邮递员阻止了。我读到这是一个 ssl 问题,经过一些研究,我发现了另一个名为 https 的模块。
这是我当前的代码。
 var http = require('http');
var server = http.createServer(app);
嘿,请确保 Postman 中的拦截器已关闭(它应该位于顶部,“登录”按钮的左侧)
与 https 相关,如 Node.js v5.10.1 文档中所述
HTTPS 是基于 TLS/SSL 的 HTTP 协议。在 Node.js 中,这是作为单独的模块实现的。
我曾经使用它通过 https(端口 443)从我的服务器向其他服务器发出请求。
顺便说一句,你的代码不应该工作,试试这个
const http = require('http');
http.createServer( (request, response) => {
   response.writeHead(200, {'Content-Type': 'text/plain'});
   response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
并在 Postman 中使用http://127.0.0.1:8124 ..希望它有帮助
| 归档时间: | 
 | 
| 查看次数: | 4734 次 | 
| 最近记录: |