Backend development
We want to develop a very simple backend for a Todo application. Please note that Vapor is in active development and our backend application will need regular updates to keep up. Therefore, our GitHub (https://github.com/PacktPublishing/Swift-Functional-Programming) repository will be updated frequently.
Model
We will start by creating our model. The code is as follows:
import Vapor
import Fluent
final class Todo: Model {
var id: Node?
var todoId: Int
var name: String
var description: String
var notes: String
var completed: Bool
var synced: Bool
var exists: Bool = false
init(node: Node, in context: Context) throws {
id = try node.extract("id")
todoId = try node.extract("todoId")
name = try node.extract("name")
description = try node.extract("description")
notes = try node.extract("notes")
completed = try node.extract("completed")
synced = try node.extract("synced...