GraphQLSwift / GraphQL

The Swift GraphQL implementation for macOS and Linux
MIT License
938 stars 72 forks source link

How to use the api with vapor 3 #36

Closed fruitcoder closed 6 years ago

fruitcoder commented 6 years ago

I'm trying to get this to work with vapor 3's async api, but I cannot figure out how to do this without the resolver accepting a Future instead of the map (synchronously). I couldn't even hack it through wait() because it's not allowed for EventLoopFutures.

resolve: { src, arguments, context, info in
  guard let connectable = context as? DatabaseConnectable else { throw MissingContext() }
  return try MessageController().getById(1, on: connectable) //.wait()
}