Swiftpack.co - BiAtoms/Http.swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by BiAtoms.
BiAtoms/Http.swift 2.2.1
A tiny HTTP server engine written in swift.
⭐️ 121
🕓 4 years ago
linux macOS iOS
.package(url: "https://github.com/BiAtoms/Http.swift.git", from: "2.2.1")

Platform Linux Platform Cocoapods Compatible Carthage Compatible License Build Status - Master

Http.swift

A tiny HTTP server engine written in swift.

Features

  • SSL/TLS support
  • Error handling
  • Global middlewares
  • Route middlewares
  • Route grouping
  • File serving
  • Directory browsing
  • Request parameters
  • Works in Linux, iOS, macOS and tvOS
import HttpSwift
// ...
let server = Server()
server.get("/hello/{id}") { request in
    print(request.queryParams["state"])
    return .ok(request.routeParams["id"]!) 
}

try server.run() //go to http://localhost:8080/hello/1?state=active in the browser

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Http.swift into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
target '<Your Target Name>' do
  pod 'Http.swift', '~> 2.2.0'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Http.swift into your Xcode project using Carthage, specify it in your Cartfile:

github "BiAtoms/Http.swift" ~> 2.2.0

Run carthage update to build the framework and drag the built HttpSwift.framework into your Xcode project.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Http.swift does support its use on supported platforms.

Once you have your Swift package set up, adding Http.swift as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/BiAtoms/Http.swift.git", from: "2.2.0")
]

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

GitHub

link
Stars: 121
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Version 2.2.1
4 years ago
  • Fixed #16

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