Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khanlou/Meridian
Meridian is a web server written in Swift that lets you write your endpoints in a declarative way.
https://github.com/khanlou/Meridian
Last synced: about 1 month ago
JSON representation
Meridian is a web server written in Swift that lets you write your endpoints in a declarative way.
- Host: GitHub
- URL: https://github.com/khanlou/Meridian
- Owner: khanlou
- License: mit
- Created: 2020-09-03T23:44:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T18:45:43.000Z (3 months ago)
- Last Synced: 2024-10-02T04:57:14.398Z (2 months ago)
- Language: Swift
- Size: 193 KB
- Stars: 315
- Watchers: 8
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-result-builders - Meridian - A web server written in Swift that lets you write your endpoints in a declarative way (Server-Side)
README
# Meridian
Meridian is a web server written in Swift that lets you write your endpoints in a declarative way.
Here is an example endpoint:
```swift
struct SampleEndpoint: Responder {
@QueryParameter("sort_direction") var sortDirection: SortDirection = .ascending
@URLParameter(\.id) var userID
@EnvironmentObject var database: Database
func execute() 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.2.5"),
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](Documentation/) folder.