Swiftpack.co - Package - khanlou/Meridian

Meridian

Meridian is a web server written in Swift that lets you write your endpoints in a declarative way.

Here is an example endpoint:


struct SampleEndpoint: Route {
  
    @QueryParameter("sort_direction") var sortDirection: SortDirection
  
    @URLParameter(\.id) var userID
    
    @EnivronmentObject var database: Database
    
    func body() throws {
        JSON(database.fetchFollowers(of: userID, sortDirection: sortDirection))
    }
  
}

Server(errorRenderer: BasicErrorRenderer())
    .register {

        SampleEndpoint()
            .on("/api/users/\(\.id))/followers")

    }
    .environmentObject(Database())
    .listen()

Github

link
Stars: 20

Used By

Total: 0

Releases

- 2020-09-06 22:17:58

  • [x] Route groups, with error renderer overrides
  • [x] Method Property Wrapper
  • [x] Header Property Wrapper
  • [x] Path Property Wrapper
  • [x] Support for custom property wrappers
  • [x] URLParameter is more type aware
  • [x] EnvironmentKey is more type aware
  • [x] Supports OPTIONS method and CORS

Initial release! - 2020-09-03 23:57:43