I\'m new to Node.js. I already have a frontend javascript script that uses an API and gets weather data like so:
function getTextWeatherUsingStation(theStation){
$.getJSON
is jQuery's function for front to make http
requests.
You are on backend now. So things will be little different here. This is not how you make requests from backend instead should consider using one of the native modules to make http
requests which is http
module and you use it like
http.request(Options, function(res) { ...
Or if you want to use something like getJson
here is get-json library that you can use like
getJSON('URL', function(error, response){..
Ofcourse you'll have to install it first with npm install get-json
then use in your project like var getJSON = require('get-json')