I am using Vapor and one of the first thing is to use get method which looks like following:
drop.get("hello") { request in
return "Hello, world!"
}
Now my understanding was that the closures are like variable of type functions. Correct? Here I see we call a method get
on an instance of Droplet
class called drop and pass in a string.
What is with the closure being called/passed inside the get method body? How do I read this?