This is my app.js:
const express = require("express");
//const https = require("https");
const app = express();
app.get("/", function(req, res) {
const query = niall;
// Follow procedure here to get access_token and refresh_token: https://benwiz.com/blog/create-spotify-refresh-token/
const access_token = {access_token};
const token = "Bearer " + access_token;
var searchUrl = "https://api.spotify.com/v1/search?q=" + query + "&type=track&limit=4";
////////WRITE YOUR CODE HERE//////////
});
// Starting the server. Should this be placed at the top of all other commands?
app.listen(3000, function() {
console.log("Server is running on port 3000.")
})
Expected Behaviour:
We are to get results from the api endpoint using https.get method.
The returned data is to be parsed to JSON.
We need to store the value of track ID, from this JSON output, into a variable and log it in the console.
Helpful Resources:
- Follow the steps here to get the access_token: https://benwiz.com/blog/create-spotify-refresh-token/
- Understand parameters here: https://developer.spotify.com/documentation/web-api/reference/#category-search
- Spotify Web Console to understand the JSON arrangement: https://developer.spotify.com/console/get-search-item/
I'm really in need of help. Any help would be appreciated.