mirror of
https://github.com/foomo/coreml-service-yolov8.git
synced 2025-10-16 12:25:42 +00:00
feat: bootstrapped vapor app
This commit is contained in:
parent
f8a4033cee
commit
e2cad818e8
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Packages
|
||||||
|
.build
|
||||||
|
xcuserdata
|
||||||
|
*.xcodeproj
|
||||||
|
DerivedData/
|
||||||
|
.DS_Store
|
||||||
|
db.sqlite
|
||||||
|
.swiftpm
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
! .env.example
|
||||||
|
.vscode
|
||||||
195
Package.resolved
Normal file
195
Package.resolved
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
{
|
||||||
|
"originHash" : "9601def0803e68c5503fba774ec7cf42e0c534f84aa23411ccb532ebec4aa45f",
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "async-http-client",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/swift-server/async-http-client.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "fb308ee72f3d4c082a507033f94afa7395963ef3",
|
||||||
|
"version" : "1.21.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "async-kit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/vapor/async-kit.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "7ece208cd401687641c88367a00e3ea2b04311f1",
|
||||||
|
"version" : "1.19.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "console-kit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/vapor/console-kit.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "a31f44ebfbd15a2cc0fda705279676773ac16355",
|
||||||
|
"version" : "4.14.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "multipart-kit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/vapor/multipart-kit.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "12ee56f25bd3fc4c2d09c2aa16e69de61dc786e8",
|
||||||
|
"version" : "4.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "routing-kit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/vapor/routing-kit.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "2a92a7eac411a82fb3a03731be5e76773ebe1b3e",
|
||||||
|
"version" : "4.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-algorithms",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-algorithms.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",
|
||||||
|
"version" : "1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-atomics",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-atomics.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
|
||||||
|
"version" : "1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-collections",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-collections.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
|
||||||
|
"version" : "1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-crypto",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-crypto.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "f0525da24dc3c6cbb2b6b338b65042bc91cbc4bb",
|
||||||
|
"version" : "3.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-http-types",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-http-types",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65",
|
||||||
|
"version" : "1.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-log",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-log.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
|
||||||
|
"version" : "1.5.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-metrics",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-metrics.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "971ba26378ab69c43737ee7ba967a896cb74c0d1",
|
||||||
|
"version" : "2.4.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-nio",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-nio.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982",
|
||||||
|
"version" : "2.64.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-nio-extras",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-nio-extras.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63",
|
||||||
|
"version" : "1.22.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-nio-http2",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-nio-http2.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "0904bf0feb5122b7e5c3f15db7df0eabe623dd87",
|
||||||
|
"version" : "1.30.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-nio-ssl",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-nio-ssl.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5",
|
||||||
|
"version" : "2.26.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-nio-transport-services",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-nio-transport-services.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce",
|
||||||
|
"version" : "1.20.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-numerics",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-numerics.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
|
||||||
|
"version" : "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-system",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-system.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "025bcb1165deab2e20d4eaba79967ce73013f496",
|
||||||
|
"version" : "1.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "vapor",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/vapor/vapor.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "8409c3c296e7f8965df14e906dbcd44eb68f54a9",
|
||||||
|
"version" : "4.92.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "websocket-kit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/vapor/websocket-kit.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",
|
||||||
|
"version" : "2.15.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 3
|
||||||
|
}
|
||||||
35
Package.swift
Normal file
35
Package.swift
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// swift-tools-version:5.10
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "coreml-service-yolov8",
|
||||||
|
platforms: [
|
||||||
|
.macOS(.v13)
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
// 💧 A server-side Swift web framework.
|
||||||
|
.package(url: "https://github.com/vapor/vapor.git", from: "4.92.4"),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.executableTarget(
|
||||||
|
name: "App",
|
||||||
|
dependencies: [
|
||||||
|
.product(name: "Vapor", package: "vapor"),
|
||||||
|
],
|
||||||
|
swiftSettings: swiftSettings
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "AppTests",
|
||||||
|
dependencies: [
|
||||||
|
.target(name: "App"),
|
||||||
|
.product(name: "XCTVapor", package: "vapor"),
|
||||||
|
],
|
||||||
|
swiftSettings: swiftSettings
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
var swiftSettings: [SwiftSetting] { [
|
||||||
|
.enableUpcomingFeature("DisableOutwardActorInference"),
|
||||||
|
.enableExperimentalFeature("StrictConcurrency"),
|
||||||
|
] }
|
||||||
0
Public/.gitkeep
Normal file
0
Public/.gitkeep
Normal file
0
Sources/App/Controllers/.gitkeep
Normal file
0
Sources/App/Controllers/.gitkeep
Normal file
9
Sources/App/configure.swift
Normal file
9
Sources/App/configure.swift
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import Vapor
|
||||||
|
|
||||||
|
// configures your application
|
||||||
|
public func configure(_ app: Application) async throws {
|
||||||
|
// uncomment to serve files from /Public folder
|
||||||
|
// app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
||||||
|
// register routes
|
||||||
|
try routes(app)
|
||||||
|
}
|
||||||
21
Sources/App/entrypoint.swift
Normal file
21
Sources/App/entrypoint.swift
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import Vapor
|
||||||
|
import Logging
|
||||||
|
|
||||||
|
@main
|
||||||
|
enum Entrypoint {
|
||||||
|
static func main() async throws {
|
||||||
|
var env = try Environment.detect()
|
||||||
|
try LoggingSystem.bootstrap(from: &env)
|
||||||
|
|
||||||
|
let app = Application(env)
|
||||||
|
defer { app.shutdown() }
|
||||||
|
|
||||||
|
do {
|
||||||
|
try await configure(app)
|
||||||
|
} catch {
|
||||||
|
app.logger.report(error: error)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
try await app.execute()
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Sources/App/routes.swift
Normal file
11
Sources/App/routes.swift
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import Vapor
|
||||||
|
|
||||||
|
func routes(_ app: Application) throws {
|
||||||
|
app.get { req async in
|
||||||
|
"It works!"
|
||||||
|
}
|
||||||
|
|
||||||
|
app.get("hello") { req async -> String in
|
||||||
|
"Hello, world!"
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Tests/AppTests/AppTests.swift
Normal file
15
Tests/AppTests/AppTests.swift
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
@testable import App
|
||||||
|
import XCTVapor
|
||||||
|
|
||||||
|
final class AppTests: XCTestCase {
|
||||||
|
func testHelloWorld() async throws {
|
||||||
|
let app = Application(.testing)
|
||||||
|
defer { app.shutdown() }
|
||||||
|
try await configure(app)
|
||||||
|
|
||||||
|
try app.test(.GET, "hello", afterResponse: { res in
|
||||||
|
XCTAssertEqual(res.status, .ok)
|
||||||
|
XCTAssertEqual(res.body.string, "Hello, world!")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user