'created CapCollectorServer from template https://github.com/twostraws/vapor-clean'

This commit is contained in:
christophhagen 2020-05-17 20:01:30 +02:00
commit bdbdcf2081
15 changed files with 224 additions and 0 deletions

68
.gitignore vendored Normal file
View File

@ -0,0 +1,68 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
.DS_Store
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

21
LICENSE Executable file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) YOUR NAME HERE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

16
Package.swift Executable file
View File

@ -0,0 +1,16 @@
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "CapCollectorServer",
dependencies: [
// 💧 A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", .upToNextMinor(from: "3.3.0")),
],
targets: [
.target(name: "App", dependencies: ["Vapor"]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App"]),
]
)

0
Public/.gitkeep Executable file
View File

15
README.md Executable file
View File

@ -0,0 +1,15 @@
# Vapor Clean
This is a template for Vapor 3 users that does the absolute minimum to set up a working Vapor 3 environment.
Unlike the official templates that are currently available, this template does not include vast swathes of extra example code that you will always need to delete. Instead, it adds just a single “hello” route so you can be sure everything is working correctly.
Although this repository contains a LICENSE file, this is meant for you to replace with whatever license you intend to use  please consider what little code is in this repository as public domain, and yours to do with as you please.
Its my hope that the official Vapor project will add a template similar to this one at some point in the future, but until then please use this however you want.
## Try it out
If you have already installed the Vapor toolbox, you can create a new Vapor project from this repo using the following command:
vapor new MyProject --template=twostraws/vapor-clean

0
Resources/Views/.gitkeep Executable file
View File

9
Sources/App/boot.swift Executable file
View File

@ -0,0 +1,9 @@
import Routing
import Vapor
/// Called after your application has initialized.
///
/// [Learn More ](https://docs.vapor.codes/3.0/getting-started/structure/#bootswift)
public func boot(_ app: Application) throws {
// your code here
}

17
Sources/App/configure.swift Executable file
View File

@ -0,0 +1,17 @@
import Vapor
/// Called before your application initializes.
///
/// [Learn More ](https://docs.vapor.codes/3.0/getting-started/structure/#configureswift)
public func configure(
_ config: inout Config,
_ env: inout Environment,
_ services: inout Services
) throws {
// Register routes to the router
let router = EngineRouter.default()
try routes(router)
services.register(router, as: Router.self)
// Configure the rest of your application here
}

11
Sources/App/routes.swift Executable file
View File

@ -0,0 +1,11 @@
import Routing
import Vapor
/// Register your application's routes here.
///
/// [Learn More ](https://docs.vapor.codes/3.0/getting-started/structure/#routesswift)
public func routes(_ router: Router) throws {
router.get("hello") { req in
return "Hello, world!"
}
}

26
Sources/Run/main.swift Executable file
View File

@ -0,0 +1,26 @@
import App
import Service
import Vapor
import Foundation
// The contents of main are wrapped in a do/catch block because any errors that get raised to the top level will crash Xcode
do {
var config = Config.default()
var env = try Environment.detect()
var services = Services.default()
try App.configure(&config, &env, &services)
let app = try Application(
config: config,
environment: env,
services: services
)
try App.boot(app)
try app.run()
} catch {
print(error)
exit(1)
}

0
Tests/.gitkeep Executable file
View File

13
Tests/AppTests/AppTests.swift Executable file
View File

@ -0,0 +1,13 @@
import App
import Dispatch
import XCTest
final class AppTests : XCTestCase {
func testNothing() throws {
XCTAssert(true)
}
static let allTests = [
("testNothing", testNothing),
]
}

0
Tests/LinuxMain.swift Executable file
View File

25
circle.yml Executable file
View File

@ -0,0 +1,25 @@
version: 2
jobs:
macos:
macos:
xcode: "9.2"
steps:
- checkout
- run: swift build
- run: swift test
linux:
docker:
- image: norionomura/swift:swift-4.1-branch
steps:
- checkout
- run: apt-get update
- run: apt-get install -yq libssl-dev
- run: swift build
- run: swift test
workflows:
version: 2
tests:
jobs:
- linux
# - macos

3
cloud.yml Executable file
View File

@ -0,0 +1,3 @@
type: "vapor"
swift_version: "4.2.0"
run_parameters: "serve --port 8080 --hostname 0.0.0.0"