Skip to content

sublimate(in:use:)

mxcl edited this page Oct 23, 2020 · 5 revisions

sublimate(in:use:)

Creates a sublimate routable for a route that returns Vapor.Response

@_disfavoredOverload public func sublimate(in options: CO₂DB.RouteOptions? = nil, use closure: @escaping (CO) throws -> Response) -> (Request) throws -> EventLoopFuture<Response>
let route = sublimate { rq in
    Vapor.Response(status: .ok)
}

app.routes.get(use: route)

Parameters

  • in: Provide .transaction to have this route contained in a database transaction.

sublimate(in:use:)

Creates a sublimate routable for a route that returns NIOHTTP1.HTTPResponseStatus

public func sublimate(in options: CO₂DB.RouteOptions? = nil, use closure: @escaping (CO) throws -> Void) -> (Request) throws -> EventLoopFuture<HTTPResponseStatus>
let route = sublimate { rq in
    NIOHTTP1.HTTPResponseStatus.ok
}

app.routes.get(use: route)

Parameters

  • in: Provide .transaction to have this route contained in a database transaction.

sublimate(in:use:)

Creates an authenticated sublimate routable for a route that returns Vapor.Response

@_disfavoredOverload public func sublimate<User: Authenticatable>(in options: CO₂DB.RouteOptions? = nil, use closure: @escaping (CO, User) throws -> Response) -> (Request) throws -> EventLoopFuture<Response>

Parameters

  • in: Provide .transaction to have this route contained in a database transaction.

sublimate(in:use:)

Creates a sublimate routable for a route that returns ResponseEncodable

@_disfavoredOverload public func sublimate<E: ResponseEncodable>(in options: CO₂DB.RouteOptions? = nil, use closure: @escaping (CO) throws -> E) -> (Request) throws -> EventLoopFuture<Response>

Parameters

  • in: Provide .transaction to have this route contained in a database transaction.

sublimate(in:use:)

Creates an authenticated sublimate routable for a route that returns ResponseEncodable

@_disfavoredOverload public func sublimate<E: ResponseEncodable, User: Authenticatable>(in options: CO₂DB.RouteOptions? = nil, use closure: @escaping (CO, User) throws -> E) -> (Request) throws -> EventLoopFuture<Response>

Parameters

  • in: Provide .transaction to have this route contained in a database transaction.

sublimate(in:use:)

Creates an authenticated sublimate routable for a route that returns Void

public func sublimate<User: Authenticatable>(in options: CO₂DB.RouteOptions? = nil, use closure: @escaping (CO, User) throws -> Void) -> (Request) throws -> EventLoopFuture<HTTPResponseStatus>

Parameters

  • in: Provide .transaction to have this route contained in a database transaction.