Giter Club home page Giter Club logo

swifter's Introduction

What is Swift?

Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project โ€” or for addition into your current app โ€” because Swift code works side-by-side with Objective-C.

What is Swifter?

Tiny http server engine written in Swift ( https://developer.apple.com/swift/ ) programming language.

Platform Swift Protocols CocoaPods Carthage Compatible

How to start?

let server = HttpServer()
server["/hello"] = { .OK(.Html("You asked for " + $0.url)) }
server.start()

How to share files?

let server = HttpServer()
server["/desktop/:path"] = shareFilesFromDirectory("/Users/me/Desktop")
server.start()

How to redirect?

let server = HttpServer()
server["/redirect"] = { request in
  return .MovedPermanently("http://www.google.com")
}
server.start()

How to HTML ?

let server = HttpServer()
server["/my_html"] = scopes { 
  html {
    body {
      h1 { inner = "hello" }
    }
  }
}
server.start()

How to WebSockets ?

let server = HttpServer()
server["/websocket-echo"] = websocket({ (session, text) in
  session.writeText(text)
}, { (session, binary) in
  session.writeBinary(binary)
})
server.start()

CocoaPods? Yes.

# Use version >= 1.1.0.rc.2 (sudo gem install cocoapods --pre)
use_frameworks!
pod 'Swifter', '~> 1.3.2'

Carthage? Also yes.

# Use version >= 0.18 (https://github.com/Carthage/Carthage/releases/tag/0.18)
github "glock45/swifter" == 1.3.2

Swift Package Manager.

import PackageDescription

let package = Package(
    name: "MyServer",
    dependencies: [
        .Package(url: "https://github.com/httpswift/swifter.git", majorVersion: 1)
    ]
)

swifter's People

Contributors

damian-kolakowski avatar julien-c avatar mbarnach avatar palleas avatar pyanfield avatar pvzig avatar tanner0101 avatar nickplee avatar bgerstle avatar ziper1 avatar lucatorella avatar mhmiles avatar pculligan avatar jetforme avatar soutaro avatar yawaramin avatar damuellen avatar arcz avatar xlc avatar c0deh4cker avatar cocoabob avatar johnno1962 avatar trozware avatar sauliusgrigaitis avatar makenowjust avatar bygri avatar sillyplus avatar lawrencelomax avatar phimage avatar tangshi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.