GithubHelp home page GithubHelp logo

yaole / taylor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from izqui/taylor

0.0 1.0 0.0 18.87 MB

A lightweight library for writing HTTP web servers with Swift

License: MIT License

Swift 96.84% Objective-C 0.47% Ruby 2.69%

taylor's Introduction

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

taylor's People

Contributors

beatrichartz avatar danappelxx avatar izqui avatar kevinup7 avatar perezpaya avatar readmecritic avatar simonrentzke avatar terwanerik avatar

Watchers

 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.