This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// KituraClient | |
// | |
// Created by Siavash Abbasalipour on 26/9/16. | |
// Copyright © 2016 MobileDen. All rights reserved. | |
// | |
import UIKit | |
class ViewController: UIViewController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PackageDescription | |
let package = Package( | |
name: “Microservice1”, | |
targets: [ | |
Target(name: “Microservice1”, dependencies: []) | |
], | |
dependencies: [ | |
.Package(url: “https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 0), | |
.Package(url: “https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 0), | |
.Package(url: “https://github.com/IBM-Swift/Swift-cfenv.git", majorVersion: 1, minor: 7), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ProfileDatabase.swift | |
// Microservice1 | |
// | |
// Created by Siavash Abbasalipour on 28/9/16. | |
// | |
// | |
import Foundation | |
import PostgreSQL | |
enum DBError: Error { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func postToDB(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) throws { | |
Log.debug(“POST — /addtodb route handler…”) | |
response.headers[“Content-Type”] = “application/json; charset=utf-8” | |
var jsonResponse = JSON([:]) | |
if let body = request.body { | |
switch body { | |
case .json(let json): | |
let fname = json[“fname”].stringValue | |
let lname = json[“lname”].stringValue | |
do { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PackageDescription | |
let package = Package( | |
name: “Microservice2”, | |
targets: [ | |
Target(name: “Microservice2”, dependencies: []) | |
], | |
dependencies: [ | |
.Package(url: “https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 0), | |
.Package(url: “https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 0), | |
.Package(url: “https://github.com/IBM-Swift/Swift-cfenv.git", majorVersion: 1, minor: 7), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Controller.swift | |
// Microservice2 | |
// | |
// Created by Siavash on 26/9/16. | |
// | |
// | |
import Foundation | |
import Kitura | |
import SwiftyJSON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright IBM Corporation 2016 | |
# | |
# Licensed under the Apache License, Version 2.0 (the “License”); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an “AS IS” BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PackageDescription | |
let package = Package( | |
name: “Microservice1”, | |
targets: [ | |
Target(name: “Microservice1”, dependencies: []) | |
], | |
dependencies: [ | |
.Package(url: “https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 0), | |
.Package(url: “https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 0), | |
.Package(url: “https://github.com/IBM-Swift/Swift-cfenv.git", majorVersion: 1, minor: 7), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Controller.swift | |
// Microservice1 | |
// | |
// Created by Siavash on 26/9/16. | |
// | |
// | |
import Foundation | |
import Kitura | |
import SwiftyJSON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Kitura | |
import LoggerAPI | |
import HeliumLogger | |
import CloudFoundryEnv | |
import CloudFoundryDeploymentTracker | |
do { | |
// HeliumLogger disables all buffering on stdout | |
HeliumLogger.use(LoggerMessageType.info) | |
let controller = try Controller() |
OlderNewer