• Stars
    star
    926
  • Rank 49,328 (Top 1.0 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight library for writing HTTP web servers with Swift

Taylor Version Carthage compatible Slack Status

Disclaimer: Not actively working on it anymore. You can check out some alternatives

Swift 2.0 required. Working with Xcode 7.1.

Disclaimer: It is a work in progress, it may break. Use it at your own risk.

Taylor is a library which allows you to create web server applications in Swift

Status

At this moment, Taylor only supports GET, POST and PUT HTTP requests. Better documentation is on the way.

Hello World

import Taylor

let server = Taylor.Server()

server.get("/") { req, res in
    res.bodyString = "Hello, world!"
    return .Send
}

let port = 3002
do {
   print("Starting server on port: \(port)")
   try server.serveHTTP(port: port, forever: true)
} catch {
   print("Server start failed \(error)")
}

More advanced usage instructions coming soon!

Playground

The easiest way to try out Taylor is using a playground.

For this, you need to have Carthage installed in your computer, is what it is used for fetching the dependencies.

$ git clone https://github.com/izqui/Taylor.git -b playground
$ cd taylor
$ sh setup.sh

And that's it, you should be good to go. Have fun!

Usage

You can use Taylor from the command line using CocoaPods Rome or Carthage as dependency managers.

Carthage

Create a Cartfile:

github "izqui/taylor"

And then run:

$ carthage update
$ xcrun swift -F Carthage/Build/Mac yourfile.swift

CocoaPods Rome

Create a Podfile:

platform :osx, '10.10'

plugin 'cocoapods-rome'

pod 'Taylor'

And then run:

$ pod install
$ xcrun swift -F Rome yourfile.swift

Credits to Ayaka Nonaka's Swift Summit talk for sharing this method for doing Scripting in Swift

Dependencies

Right now Taylor relies on an Swift library called SwiftSockets.

Development

Join our Slack Slack Status

For the development of the Taylor framework we use Carthage for managing dependencies.

To contribute to Taylor, clone the project on your local machine and run:

$ carthage bootstrap

Then you can open Taylor.xcodeproj and start developing.

The reason there is a Mac app inside the project is for testing purposes given that you cannot have frameworks linked with a Command Line application in Xcode using Carthage. See here.

Inspiration

More Repositories

1

blockchain

A basic blockchain implementation written in Go
Go
841
star
2

SHSidebarController

Sidebar with folding effect for iOS
Objective-C
173
star
3

todos

Get the TODO's in your code directly into Github Issues
Go
70
star
4

keybase-ethereum-registry

JavaScript
34
star
5

Poker.swift

♠️β™₯️♣️♦️ Swift library for experimenting with Poker.
Swift
18
star
6

net

Mesh networking prototype/experimentation written in Go.
Go
13
star
7

Memoface

Pebble watch face that allows you to quickly glance a note
CSS
12
star
8

block.chat

Ethereum backed messaging protocol with encryption and blockchain timestamping built-in.
JavaScript
8
star
9

ADNPebbleApp

A small app.net client for the Pebble
Objective-C
8
star
10

Localize

Localising strings in Swift
Swift
7
star
11

TheList-iOS

iOS Client for The List (http://thelist.io)
Objective-C
6
star
12

izqui.me

My nodeJS powered JSON Portfolio/CV
Shell
6
star
13

iPadSfera-iOS-Tutoriales

http://www.ipadsfera.com/category/tutoriales/programacion/
Objective-C
6
star
14

gittask

A Github based task tracker for Github projects
Go
5
star
15

Ohai-Pebble

Pebble app that checks-in Ohai for App.net (http://ohaiapp.net/)
C
5
star
16

MagicRemoteHelper

Mac companion app for MagicRemote
Objective-C
4
star
17

ArduinoiOSIntegration

Controlling a LED intensity from an iOS app
Objective-C
4
star
18

RaspiAutoTorrents

4
star
19

beacon

Go iBeacon library
Go
3
star
20

block.chat-protocol

JavaScript
2
star
21

camera-shooter

Go
2
star
22

pi-os

Assembly
1
star
23

JobPrep-HackerSchool

Job Prep exercises done in Hacker School on Fridays
JavaScript
1
star
24

siriproxy-izqui

Just playing with SiriProxy
Ruby
1
star
25

Wallet

A framework for creating Wallet (formerly Passbook) cards written in Swift
1
star