Our post call returns a list of items. Also, we can get items with this:
/// List todo items
drop.get("todos") { request in
let todos = TodoStore.sharedInstance
let json: [Todo] = todos.listItems()
return try JSON(node: json)
}
We will build and run our application with Vapor CLI again and we can test this get request as follows:
curl -X "GET" "http://localhost:8080/todos"
-H "Cookie: test=123"