You can add more routes to your project as follows:
- Open Application.swift in Xcode and add the following code to the line right after initializeHealthRoutes(app: self) in the PostInit() function:
. . .
// add after initializeHealthRoutes(app: self)
router.get("/greet") { request, response, next in // [1]
if let guest = request.queryParameters["guest"] { // [2]
response.send("Hi \(guest), greetings! Thanks for visiting us.") // [3]
} else {
response.send("Hi stranger, It's nice meeting with you.")
}
}
router.get("/student/:name") { request, response, next in // [4]
let studentName = request.parameters["name"]!
let studentRecords = [ // [5]
"Peter" : 3.42,
"Thomas" : 2.98,
"Jane" : 3.91,
"Ryan" : 4.00,
"Kyle...