Created
November 7, 2016 07:43
-
-
Save harishgonnabattula/1b255787a854e5734878fd5fbb579de7 to your computer and use it in GitHub Desktop.
Shell scrip to create a Kitura project, install the dependencies and start the server. You can add dependencies in this file only and just run the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Shell script to automate creation and build of Kitura server | |
echo "Enter name for project" | |
read project_name | |
export $project_name | |
#Begin | |
# Creation of Kitura application | |
mkdir $project_name | |
cd $project_name | |
swift package init --type executable | |
echo "import PackageDescription | |
let package = Package( | |
name: \"$project_name\", | |
dependencies: [ | |
.Package(url: \"https://github.com/IBM-Swift/Kitura.git\", majorVersion: 1, minor: 0) | |
])" >Package.swift | |
echo "import Kitura | |
let router = Router() | |
router.get(\"/\") { | |
request, response, next in | |
response.send(\"Hello, World!\") | |
next() | |
} | |
Kitura.addHTTPServer(onPort: 8090, with: router) | |
Kitura.run()" > ./Sources/main.swift | |
swift build | |
echo ".build/debug/$project_name" > ./server.sh | |
sh server.sh | |
#End of command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment