我正在开发一个仪表板,我需要连接到 API 并捕获身份验证令牌,然后使用 HTTPS 协议发送信息。我使用 Nodejs,当我运行代码时,pm2 monit 上出现下一个错误:
Error: getaddrinfo ENOTFOUND my.url.net/path
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'my.url.net/path'
}Run Code Online (Sandbox Code Playgroud)
这也是我发出请求的代码(Node.js):
const path = require('path');
require('dotenv').config({path: path.join('path','.env')});
const https = require('https');
const database = require('./sql');
const fs = require ('fs');
const user = process.env.USER;
const pwd = PWD;
const host = 'https://my.url.net/extencio';
const host_1 = 'my.url.net/extention';
async function getLoginToken(pForce){
if (login_token.Health && !pForce) { return login_token }
//Creates the POST request
const options …Run Code Online (Sandbox Code Playgroud)