Chapter 7 - Type of expression is ambiguous without more context - Unable to build

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
            let searchTerm = req.query[String.self, at: "term"] else {
                throw Abort(.badRequest)
        return Acronym.query(on: req)
        .filter(.short == searchTerm)


Anyone know why I am getting this error?


I was missing Import Fluent.

1 Like

@rniller Glad you fixed it! :]

Lol rookie mistake on my part :stuck_out_tongue: Btw, this book is amazing! I’m so glad I stumbled upon it.

1 Like