Being new to Swift and Vapor, I'm experimenting with a Vapor project. It has a simple route, which fetches data from a DB via MySQL for Swift, then passes the ResultSet
to the Leaf template. Here's what I am attempting:
drop.get("report") {req in
let data = try mysql.execute("select * from things")
return try drop.view.make("report", ["data":data])
}
But Swift complains with this error:
error: cannot convert value of type '[[String : Node]]' to expected dictionary value type 'Node'
return try drop.view.make("report", ["data":data])
^~~~
It feels like I'm missing a type-casting step, but what is it?