函数未返回值nodeJS

时间:2019-12-18 10:47:53

标签: node.js ajax express

我无法返回值,它显示为空:

const request = require('request');
const key = require('./key/key');
getweather = (city) => {
  request(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${key}`,(err, response, body)=>{
    return JSON.parse(body);
  })
};
module.exports = getweather;

0 个答案:

没有答案