shades
November 11, 2018, 11:50pm
1
After adding a getAllHandler in the AcronymsController it says that you should remove 5 lines in routes.swift:
router.get("api", "acronyms") { req -> Future<Acronym> in
return try req.content.decode(Acronym.self)
.flatMap(to: Acronym.self) { acronym in
return acronym.save(on: req)
}
}
That is the creating a new Acronym function with a get verb in the beginning. I believe it should be the:
router.get("api", "acronyms") { req -> Future<[Acronym]> in
return Acronym.query(on: req).all()
}
function that should be removed.
@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]
indrac
November 18, 2018, 12:01pm
3
I noticed the exactly same thing. But, at this time I wrote this I read the Server Side Swift version 1.0.1, that code you write above is at the page 231.
shades
November 18, 2018, 4:01pm
4
I am reading the 1.0.1 version pdf version and the typo is at 119.
0xtim
November 20, 2018, 12:41pm
5
Hi all,
Yep that was an oversight on my part and definitely a typo! It will be fixed in the next edition.]
Thanks everyone!
1 Like