Share
Embed
Vapor meetup 2nd
quick review of Vapor meetup 1st
vapor projects setup in monstar-lab
Daisuke HIRATA(JP)
June 12, 2018
Transcript
24 slides
-
About me Daisuke Hirata Monstar Lab CTO current tech work
blockchain vapor 2 daughters -
Brief review of last meetup Tanner’s slide https://speakerdeck.com/tanner0101/an-introduction-to-vapor-3-vapor-meetup-tokyo Casper’s slide
https://docs.google.com/presentation/d/1SkDK4HfvbxJdk5BnHVxNwp_FrZnH-nH5EeavEVtSL6Y/ed it#slide=id.p Joannis’s slide https://speakerdeck.com/joannis/vapor-3 Video https://youtu.be/CbyoXkdTfM8?t=1h6m25s • There were 2 other speakers. -
Vapor in monstar-lab Project Example • Just 1 example for
real project so far • European group in Monstar-Lab, Nodes has many cases How many vapor engineers • 4 developers • backend engineer (Java -> Swift) • iOS and Vapor engineer • Techlead (strong at backend) • me -
Development Language and FrameWorks API Development • Language - Swift
(ServerSideSwift) [Version 4.1] • Framework - Vapor 3 • Test - (Framework - N/A) • TestCoverage - more than 80% Batch • Language - Swift (ServerSideSwift) [Version 4.1] • Framework - Vapor3(Version3) • Test - (Framework - N/A) • Uses: Daily Batch, Weekly Batch • TestCoverage - more than 80% -
Development Language and FrameWorks Admin Panel • Not decided (Will
be confirmed Soon) • Vapor with Leaf Template (Option 1) • SPA (Option 2) • TestCoverage - N/A Concerns - Template engine(leaf) OR JavaScript SPA like react-admin for admin panel. - If we choose SPA written in JS similar as the mobile application, so we’d be using Vapor only for the things that Vapor is really great at, that is. No need to re-create the same logic in all of API , Admin Panel and Apps. - However its learning cost is not so cheap for backend engineers. Adding another web frontend engineers separately costs much higher. -
Infra Container based Infra • we have some choices a.
Google Container Engine(GKE) b. AWS self hosted Kubernetes c. AWS ECS/Fargete d. AWS EKS (not in tokyo yet) • non-container a. Vapor Cloud (though its infra is Kubernetes in AWS) b. Heroku -
Elastic Search Library for Vapor There is no libraries for
ES in awesome-vapor. https://github.com/Cellane/awesome-vapor • We are making one (still making). • https://github.com/monstar-lab/elasticsearch-service • This library allows you to connect to a Elasticsearch server from your Vapor application, perform searches and get back Codable/Content results. Currently only searching is supported, not indices nor data manipulation. -
Testing Testing Vapor • no mock library in general. using
PoP instead • Back at WWDC 2015, Apple 'introduced' the concept of Protocol Orientated Programming. There was also a really good talk at WWDC this year on Engineering For Testability that helps explain it further. • Vapor is already heavily protocol based, which makes testing this a breeze! • Very similar idea with this article in Golang. • http://haya14busa.com/golang-how-to-write-mock-of-interface-for-testing/ • 参考 https://academy.realm.io/jp/posts/tryswift-veronica-ray-real-world-mocking-swift/ -
Routing structure • routes.swift a. register APIController.swift • APIController.swift a.
register API version controllers • V1/2Controller.swift a. register all controller under the version • Each Specific Controller a. implements request handling -
Optimizing Vapor app compile times with Xcode’s New Build System
• there’s an experimental option in Xcode 9+ that allows you to significantly cut down on compile times by employing a New Build System (internally called XCBuild). • File -> Project Settings… in Xcode -
SwiftLint integration • Vapor xcode command regenrates xcodeproj, as a
result SwiftLint setting in Build phase will be missing. • We are making a small CLI utility to wrap regenerating xcodeproj command to embed SwiftLint phase into the xcodeproj