I’m thrown an expression error of “Type of expression is ambiguous without more context” on the line expressing the return when running this router code.
// Search
router.get("API", "acronyms", "search") { req -> Future<Acronym> in
guard
let searchTerm = req.query[String.self, at: "term"] else {
throw Abort(.badRequest)
}
return Acronym.query(on: req)
.filter(.short == searchTerm)
.all()
}
Anyone know why I am getting this error?
Update:
I was missing Import Fluent
.