Swiftpack.co -  khanlou/Meridian as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
khanlou/Meridian
Meridian is a web server written in Swift that lets you write your endpoints in a declarative way.
.package(url: "https://github.com/khanlou/Meridian.git", from: "0.2.3")

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: Responder {
  
    @QueryParameter("sort_direction") var sortDirection: SortDirection = .ascending
  
    @URLParameter(\.id) var userID
    
    @EnvironmentObject 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()

Installation

Meridian uses Swift Package Manager for installation.

Add Meridian as a dependency for your package:

.package(url: "https://github.com/khanlou/Meridian.git", from: "0.0.6"),

The version should be the latest tag on GitHub.

Add Meridian as a dependency for your target as well:

.product(name: "Meridian", package: "Meridian"),

Documentation

Full documentation can be found in the Documentation folder.

GitHub

link
Stars: 181
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

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

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API