Chapter 8 - page 119 typo

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 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! :]

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.

I am reading the 1.0.1 version pdf version and the typo is at 119.

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