// api.js
let express = require("express");
let request = require("request");
const $url = "https://api2.sktelecom.com/weather/current/hourly";
let $lat = 37.539079;
let $lon = 126.990669;
const $key = "751d8762-5bcf-42b2-9121-f4bbeb68976d";
let $api = $url + "?lat=" + $lat + "&lon=" + $lon + "&appkey=" + $key;
request($api, function (error, response, body) {
let json = JSON.parse(body);
let weather = json.weather.hourly;
}
Put the data received as a request in weather
Please tell me how to transfer to another file called app.js
node.js
Let's modularize api.js App.js to api.I think there is a way to use callback when calling the js module.
In the current structure, it seems difficult to deliver the value to app.js.
579 Understanding How to Configure Google API Key
926 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
621 GDB gets version error when attempting to debug with the Presense SDK (IDE)
575 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.