Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Server Side Swift – State of the Union

Server Side Swift – State of the Union

Small presentation given at http://theswiftalps.com on November 10th, 2016, about the current options for server side apps written in Swift: Perfect, Vapor, Kitura and Zewo.

Adrian Kosmaczewski

November 10, 2016
Tweet

More Decks by Adrian Kosmaczewski

Other Decks in Technology

Transcript

  1. import Kitura let router = Router() router.get("/") { request, response,

    next in response.send("Hello, World!") next() } Kitura.addHTTPServer(onPort: 8090, with: router) Kitura.run() https://github.com/IBM-Swift/Kitura © akosma 2016 5
  2. import PerfectLib import PerfectHTTP import PerfectHTTPServer let server = HTTPServer()

    var routes = Routes() routes.add(method: .get, uri: "/", handler: { request, response in response.setHeader(.contentType, value: "text/html") response.appendBody(string: "<p>Hello, world!</p>") response.completed() } ) server.addRoutes(routes) server.serverPort = 8181 do { try server.start() } catch PerfectError.networkError(let err, let msg) { print("Network error thrown: \(err) \(msg)") } https://github.com/PerfectlySoft/Perfect © akosma 2016 7
  3. import Vapor let drop = Droplet() drop.get("hello") { req in

    return "Hello, world." } drop.run() https://github.com/vapor/vapor © akosma 2016 9
  4. import HTTPServer let router = BasicRouter { route in route.get("/hello")

    { request in return Response(body: "Hello, world!") } } let server = try Server(configuration: ["port": 8080], responder: router) try server.start() https://github.com/Zewo/Zewo © akosma 2016 11
  5. import PackageDescription let package = Package( dependencies: [ .Package(url: "https://github.com/open-swift/S4.git",

    majorVersion: 0, minor: 11) ] ) https://github.com/open-swift/S4 © akosma 2016 14
  6. Perfect Vapor Kitura Zewo S4 Inspiration Ruby on Rails Laravel

    Express.js Go (libmill) Open Initiative Design Monolithic Modular IBM Modular In progress Deployment nginx, Docker, Heroku Bluemix, AWS, Heroku… Apache, nginx, Bluemix Databases Mongo, MySQL, FileMaker… Mongo, MySQL… Templating Mustache Leaf Mustache License Apache MIT Apache MIT MIT Stars0 9200 7200 4800 1400 100 More StORM, Websockets, FastCGI Websockets WWDC16 415 0 as of November 2016 © akosma 2016 16
  7. Workshop —3 sessions of 2h each: 11:30, 14:30 & 16:30

    —Build a web API & iOS client 100% Swift —Specifications —Free choice of tools & frameworks —Team effort —Guidance and support —Fun! © akosma 2016 20
  8. Competition! —Number of implemented use cases —Code coverage —Weighted by

    number of team members —Imagination ! with a trophy! " chocolate! © akosma 2016 21
  9. Schedule Time Thursday 10th Friday 11th 09:00 - 09:30 Registrations

    Welcome back 09:30 - 11:30 Presentations Work Session 4 11:30 - 13:30 Work Session 1 Work Session 5 13:30 - 14:30 Lunch Lunch 14:30 - 16:30 Work Session 2 Work Session 6 16:30 - 18:30 Work Session 3 Presentations & End © akosma 2016 22