- Hands-On Server-Side Web Development with Swift
- Angus Yeung
- 271字
- 2021-06-10 19:00:18
Creating a hello world app from a default template
- First, create a new directory called helloWorld and change the directory to helloWorld:
# Step 1a: Create a new directory for your project
$ mkdir helloWorld
$ cd helloWorld
Kitura CLI will use the current directory's name to create your project and put all the files in the same directory.
- Next, use the kitura init command to create a new project from the default Kitura template:
# Step 1b: Create helloWorld app using the default Kitura template
$ kitura init
This step not only creates the project by fetching dependencies and setting up the project environment for you but also builds the project right away. It takes Kitura several minutes to fetch dependencies and build the helloWorld project for you:
create .swiftservergenerator-project
create .gitignore
create .swift-version
create LICENSE
create Sources/Application/InitializationError.swift
create Sources/Application/Application.swift
create spec.json
create Tests/ApplicationTests/RouteTests.swift
create Tests/LinuxMain.swift
create Sources/Application/Metrics.swift
create Sources/Application/Routes/HealthRoutes.swift
create README.md
create Sources/Application/Routes/.keep
create iterative-dev.sh
create Sources/kitura/main.swift
create Package.swift
create cli-config.yml
create Dockerfile
create Dockerfile-tools
create .dockerignore
create manifest.yml
create .cfignore
create .bluemix/toolchain.yml
create .bluemix/deploy.json
create .bluemix/scripts/container_build.sh
create .bluemix/scripts/kube_deploy.sh
create .bluemix/pipeline.yml
create chart/kitura/Chart.yaml
create chart/kitura/templates/deployment.yaml
create chart/kitura/templates/service.yaml
create chart/kitura/templates/hpa.yaml
create chart/kitura/templates/istio.yaml
create chart/kitura/templates/basedeployment.yaml
create chart/kitura/values.yaml
create chart/kitura/bindings.yaml
create Jenkinsfile
Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2)
Target: x86_64-apple-darwin17.4.0
Fetching https://github.com/IBM-Swift/HeliumLogger.git
Fetching https://github.com/IBM-Swift/CloudEnvironment.git
Fetching https://github.com/RuntimeTools/SwiftMetrics.git
Fetching https://github.com/IBM-Swift/Health.git
swift build command completed
Updating https://github.com/IBM-Swift/HeliumLogger.git
Updating https://github.com/IBM-Swift/Health.git
Updating https://github.com/RuntimeTools/SwiftMetrics.git
Updating https://github.com/IBM-Swift/CloudEnvironment.git
generate .xcodeproj command completed
Next steps:
Change directory to your app
$ cd /Users/fyeung1/Code/kitura
Run your app
$ .build/debug/kitura
After the build of the Kitura application is successful, the command outputs the recommended next steps for running the application.