【发布时间】:2021-07-05 16:43:28
【问题描述】:
我是后端编程的新手,最近我遇到了无法从 Open Map Weather API 接收任何数据的问题...我正在尝试使用 node.js 中的 https/express 发送我的请求... 我的 API 密钥和所有参数都是正确的,因为在 Postman 中一切正常...... 如果有人能帮我解决这个问题,我将不胜感激...... - 这是我的代码 btw-
const exp = require("express");
const hhh = require("https");
const app = exp();
app.get("/", (req, res) => {
const url = "https://api.openweathermap.org/data/2.5/weather?q=London&appid=249e0887318ca2b591a7911fd54fe5fe";
hhh.get(url, (response) => {
console.log(response);
})
res.send("<h1>On Air 3000</h1>")
})
app.listen(3000, () => {
console.log("Listening on 3000");
})
【问题讨论】:
标签: node.js api express visual-studio-code hyperterminal