I’m trying to GET data from another web service, then transform it and return it. I found a Spotify example in the docs, but I’m not sure how to return a portion of the JSON.
drop.get("music") { request in
guard let query = request.data["q"]?.string else {
throw Abort.badRequest
}
let result = try drop.client.get(
"https://api.spotify.com/v1/search",
query: ["type": "artist", "q": query]
)
return result.data["artists"]?.array
}
I'm getting this error when I try to build: error: return expression of type '[Polymorphic]?' does not conform to 'ResponseRepresentable'