Skip to content

khanlou/Meridian

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages