I'm trying to build a console application using JavaScript/Node.js, the following script.js throws an ReferenceError: $ is not defined
upon compilation:
//user input from command line
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("Would you like to see which Car Types are available? Please type yes/no ", function(answer) {
// if yes, print search results to console in descending price order
if (answer === 'yes'){
var results= "";
$.getJSON("https://techtest.rideways.com/dave/?pickup=3.410632,-2.157533&dropoff=3.410632,-2.157533", function(data){
results = JSON.parse(data);
});
console.log("The following Car Types are available:", results.options['car_type'], " - ", results.options['price']);
}else{
console.log("No worries, have a nice day!");
}
rl.close();
});
As shown in this post; ReferenceError: $ is not defined I'm hoping its because I'm missing the JS libraries.
Is there a way I can call the JS libraries inside my script.js without creating a separate HTML file? As I'm not building a front end web application therefore don't see the point in creating a HTML file?