Bladeren bron

Kitura demo

鲁浩 8 maanden geleden
bovenliggende
commit
732cc4fad1
4 gewijzigde bestanden met toevoegingen van 128 en 0 verwijderingen
  1. 8 0
      KituraApi/.gitignore
  2. 87 0
      KituraApi/Package.resolved
  3. 19 0
      KituraApi/Package.swift
  4. 14 0
      KituraApi/Sources/main.swift

+ 8 - 0
KituraApi/.gitignore

@@ -0,0 +1,8 @@
+.DS_Store
+/.build
+/Packages
+xcuserdata/
+DerivedData/
+.swiftpm/configuration/registries.json
+.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
+.netrc

+ 87 - 0
KituraApi/Package.resolved

@@ -0,0 +1,87 @@
+{
+  "originHash" : "7153757b46110cf121edf5a8a0709ab962e539cf044017ffef33a8aff1def724",
+  "pins" : [
+    {
+      "identity" : "bluesocket",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/BlueSocket.git",
+      "state" : {
+        "revision" : "c9894fd117457f1d006575fbfb2fdfd6f79eac03",
+        "version" : "1.0.200"
+      }
+    },
+    {
+      "identity" : "bluesslservice",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/BlueSSLService.git",
+      "state" : {
+        "revision" : "ae5889d2a8b068d2d3ab91ec73aa8f557c03cd8a",
+        "version" : "1.0.200"
+      }
+    },
+    {
+      "identity" : "kitura",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/Kitura",
+      "state" : {
+        "revision" : "daf6479097469a0c1fe64755db6e23f788a3ec29",
+        "version" : "2.9.200"
+      }
+    },
+    {
+      "identity" : "kitura-net",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/Kitura-net.git",
+      "state" : {
+        "revision" : "e017a57772eb477c294d72b25ab9ae38d25539f5",
+        "version" : "2.4.200"
+      }
+    },
+    {
+      "identity" : "kitura-templateengine",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/Kitura-TemplateEngine.git",
+      "state" : {
+        "revision" : "1670b09bfb63b66f7dffff627a06b50492485407",
+        "version" : "2.0.200"
+      }
+    },
+    {
+      "identity" : "kituracontracts",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/KituraContracts.git",
+      "state" : {
+        "revision" : "8a4778c3aa7833e9e1af884e8819d436c237cd70",
+        "version" : "1.2.201"
+      }
+    },
+    {
+      "identity" : "loggerapi",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/LoggerAPI.git",
+      "state" : {
+        "revision" : "e82d34eab3f0b05391082b11ea07d3b70d2f65bb",
+        "version" : "1.9.200"
+      }
+    },
+    {
+      "identity" : "swift-log",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/apple/swift-log.git",
+      "state" : {
+        "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
+        "version" : "1.5.4"
+      }
+    },
+    {
+      "identity" : "typedecoder",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/Kitura/TypeDecoder.git",
+      "state" : {
+        "revision" : "28ec01815c0aea9236f92982ca8d351e7112a4a0",
+        "version" : "1.3.201"
+      }
+    }
+  ],
+  "version" : 3
+}

+ 19 - 0
KituraApi/Package.swift

@@ -0,0 +1,19 @@
+// swift-tools-version: 5.10
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+import PackageDescription
+
+let package = Package(
+    name: "KituraApi",
+    dependencies: [
+            .package(url: "https://github.com/Kitura/Kitura", from: "2.8.0")
+    ],
+    targets: [
+        // Targets are the basic building blocks of a package, defining a module or a test suite.
+        // Targets can depend on other targets in this package and products from dependencies.
+        .executableTarget(
+            name: "KituraApi",
+            dependencies: ["Kitura"]   
+        ),
+    ]
+)

+ 14 - 0
KituraApi/Sources/main.swift

@@ -0,0 +1,14 @@
+// The Swift Programming Language
+// https://docs.swift.org/swift-book
+
+import Kitura
+
+let router = Router()
+
+router.get("/") { request, response, next in
+    response.send("Hello world!")
+    next()
+}
+
+Kitura.addHTTPServer(onPort: 5000, with: router)
+Kitura.run()