Server-Side Swift with Vapor, Episode 5: Challenge: Your Own Routes | raywenderlich.com

It’s time to put everything you’ve learned so far into practice and create your own routes as part of a challenge! Create 3 different routes to cover new routes, parameters and sending and receiving JSON.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/21451628-server-side-swift-with-vapor/lessons/5

RESTed App not available in the Appstore. Any other recommendation?
Currently in lesson 10.
I am trying to use Postman, but not I am not able to send JSON-decoded. Even when I use the body (in JSON format), the database at the server is not updated. I can do the GET and see the empty array.

Postman should work, make sure you’ve set the Raw body type and chosen JSON like

Hi Tim, for some reason is not working.
I am able to GET data, but not POST.
Anyway, I am working on the Leaf lessons now, I will try to test if the DB is properly working.

What’s the error you get with a POST?

Have you considered using a Swift playground to send requests to the app rather than a middleman such as RESTed or Postman?

It would be helpful to see (and manipulate) both the client and server sides in Swift and JSON…

I spent hours trying to get Post requests working with the app for lack of:

request.setValue(“application/json”, forHTTPHeaderField: “Content-Type”)

REST clients are good because when doing general backend dev, it’s what you use. Playgrounds are very Apple specific and if someone wants to follow the books or tutorials on Linux, playgrounds don’t work.

However, the book does have a chapter on building an iOS app where the content type header field is described