Sha256: fa42052a68cec2646960912fa040edd1e295df3861ee521cd4da107be3a088e4

Contents?: true

Size: 1000 Bytes

Versions: 8

Compression:

Stored size: 1000 Bytes

Contents

import Foundation

import Kitura
import KituraSys
import KituraNet
import HeliumLogger
import LoggerAPI
import SwiftyJSON

import StatsD
import <%= application_name %>

var config: JSON? = nil
var statsD: StatsD? = nil
var router: Router? = nil

private func setupLogger() {
  Log.logger = HeliumLogger()
}

// Load the config from the json file
private func loadConfig() -> JSON? {
  if Process.arguments.count < 2 {
    Log.error("Please specify config file")

    return nil
  }

  if let jsonData = NSData(contentsOfFile: Process.arguments[1])
  {
    let config = JSON(data: jsonData)
    Log.info("Loaded config: \(config)")
    return config
  }

  return nil
}

setupLogger()
config = loadConfig()
statsD = Metrics().setupStatsD()
router = Routing(statsD: statsD!, config: config!).setupRouter()

Log.info("Starting Server on port 8090:")
statsD!.increment(bucket: "\(Buckets.Application.rawValue).\(Buckets.Started.rawValue)")

Kitura.addHTTPServer(onPort: 8090, with: router!)
Kitura.run()

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
minke-generator-swift-0.5 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.4 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.2.2 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.2.1 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.2.0 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.1.8 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.1.7 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb
minke-generator-swift-0.1.6 lib/generators/swift/scaffold/src/Sources/<%= application_name %>App/main.swift.erb