# Errata for Server-Side Swift with Vapor 3rd Edition

**URL:** <https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907>\
**Category:** Server Side Swift with Vapor\
**Created:** [March 23, 2021, 6:21pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907 "2021-03-23T18:21:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jellodiil](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jellodiil/32/109742_2.png) [@jellodiil](https://forums.kodeco.com/u/jellodiil)\
**Post date:** [March 23, 2021, 6:21pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/1 "2021-03-23T18:21:42Z")

</div>

Creating this topic to catch any typos and bugs in the 3rd Edition Edition of Server-Side Swift with Vapor.

---

<div class="post-metadata">

**Author:** ![joltguy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/joltguy/32/100397_2.png) [@joltguy](https://forums.kodeco.com/u/joltguy)\
**Post date:** [April 9, 2021, 4:51pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/2 "2021-04-09T16:51:18Z")

</div>

I hit a snag in **Chapter 19** where a couple of tests weren’t passing. Specifically the `testUpdatingAnAcronym()` and `testAcronymCanBeSavedWithAPI()` tests were failing.

I discovered that it was due to the default password not being encrypted in the `User.create(name:username:on)` extension method defined in **Models+Testable.swift**. To fix it I replaced this line:

```auto
let user = User(name: name, username: createUsername, password: "password")

```

with:

```auto
let user = User(name: name, username: createUsername, password: try Bcrypt.hash("password"))

```

I couldn’t find this change mentioned in the book (although I might have missed it). With this in place all tests are now ✅.

---

<div class="post-metadata">

**Author:** ![jellodiil](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jellodiil/32/109742_2.png) [@jellodiil](https://forums.kodeco.com/u/jellodiil)\
**Post date:** [April 11, 2021, 7:21pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/3 "2021-04-11T19:21:08Z")

</div>



---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [April 12, 2021, 9:01am UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/4 "2021-04-12T09:01:31Z")

</div>

@joltguy it’s in the very first block of code in Chapter 19 🙂

[https://www.raywenderlich.com/books/server-side-swift-with-vapor/v3.0/chapters/19-api-authentication-part-2#toc-chapter-022-anchor-001](https://www.raywenderlich.com/books/server-side-swift-with-vapor/v3.0/chapters/19-api-authentication-part-2#toc-chapter-022-anchor-001)

---

<div class="post-metadata">

**Author:** ![joltguy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/joltguy/32/100397_2.png) [@joltguy](https://forums.kodeco.com/u/joltguy)\
**Post date:** [April 12, 2021, 9:29am UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/5 "2021-04-12T09:29:52Z")

</div>

**D’oh!!** 😳

I don’t know how I missed that! It’s like I typed in most of that block but somehow skipped the bottom part. Gah… sorry about that. Thanks for pointing it out!

---

<div class="post-metadata">

**Author:** ![pantsz](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pantsz/32/110937_2.png) [@pantsz](https://forums.kodeco.com/u/pantsz)\
**Post date:** [May 9, 2021, 5:38am UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/6 "2021-05-09T05:38:39Z")

</div>

In Chapter 17, there is a sentence that has multiple “to” which I think is a typo:  
This is similar to to the existing `CreateAcronymData` in **AcronymsController.swift**.

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [May 9, 2021, 11:49am UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/7 "2021-05-09T11:49:18Z")

</div>

Thanks! I’ll get that fixed in the next update!

---

<div class="post-metadata">

**Author:** ![diggory](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/diggory/32/104529_2.png) [@diggory](https://forums.kodeco.com/u/diggory)\
**Post date:** [August 27, 2021, 3:40pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/9 "2021-08-27T15:40:03Z")

</div>

Hi Tim, I think that there’s a small typo in Chapter 8. On p111 of the PDF.

It states

> Open AcronymsController.swift in Xcode and add the following to create an AcronymsController that conforms to RouteCollection:

```auto
import Vapor
import Fluent
struct AcronymsController: RouteCollection {
  func boot(routes: RoutesBuilder) throws {
  } 
}

```

But then just over the page on p112 the next sentence states:

> RouteCollection requires you to implement boot(router:) to register routes.

I assume that the ‘router:’ parameter is a hang-over from v3 of Vapor, and that the sentence should read:

> RouteCollection requires you to implement boot(routes:) to register routes.

---

<div class="post-metadata">

**Author:** ![diggory](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/diggory/32/104529_2.png) [@diggory](https://forums.kodeco.com/u/diggory)\
**Post date:** [August 27, 2021, 4:05pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/10 "2021-08-27T16:05:26Z")

</div>

Similarly, I think that there’s some Vapor v3 code left in p114:

> Next, open routes.swift and remove the remaining acronym route handlers:

```auto
• router.post("api", "acronyms")
• router.get("api", "acronyms", Acronym.parameter)
• router.put("api", "acronyms", Acronym.parameter)
• router.delete("api", "acronyms", Acronym.parameter) 
• router.get("api", "acronyms", "search")
• router.get("api", "acronyms", "first")
• router.get("api", "acronyms", "sorted")

```

I suspect that should, instead, read:

```auto
•app.post("api", "acronyms")
•app.get("api", "acronyms", ":acronymID")
•app.put("api", "acronyms", ":acronymID")
•app.delete("api", "acronyms", ":acronymID")
•app.get("api", "acronyms", "search")
•app.get("api", "acronyms", "first")
•app.get("api", "acronyms", "sorted")

```

---

<div class="post-metadata">

**Author:** ![diggory](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/diggory/32/104529_2.png) [@diggory](https://forums.kodeco.com/u/diggory)\
**Post date:** [August 27, 2021, 4:09pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/11 "2021-08-27T16:09:01Z")

</div>

And just under that:

> Next, remove any other routes from the template. You should only have the AcronymsController registration left in routes(\_:). Next, open AcronymsController.swift and recreate the handlers by adding each of the following after boot(router:)

s/router:/routes: again.

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [August 31, 2021, 4:04pm UTC](https://forums.kodeco.com/t/errata-for-server-side-swift-with-vapor-3rd-edition/135907/12 "2021-08-31T16:04:52Z")

</div>

Thanks for spotting these! I suspect there was an errant merge somewhere. The fix should get merged and deployed soon
