brew install vapor/tap/vapor heroku-cli
Create from scratch
# start new Vapor project vapor new HelloWorld pushd HelloHelloWorld vapor xcode # I had to run this twice, first time I got a bunch of LibreSSL errors about not being able to connect to GitHub to download the dependencies rm -rf .git # vapor starts a git repo inside the project folder, but this project is inside a repo already! echo "4.1.1" > .swift-version # make Procfile for Heroku echo "web: Run --env production --hostname 0.0.0.0 --port \$PORT local: vapor run" > Procfile
At this point, the app is ready, but it has two pages and some example models and controllers, and a SQLite database connection. To simplify to a barebones Hello, world!, open the Xcode project and make the same edits as this commit.
vapor build popd
pushd HelloWorld vapor run & # or run the `Run` scheme in Xcode. popd open http://localhost:8080
Locally with Heroku
pushd HelloWorld heroku local local & open http://localhost:8080 popd
heroku create --buildpack https://github.com/vapor-community/heroku-buildpack.git # vapor/vapor is supposed to be the stable release but currently doesn't work heroku stack:set heroku-16 -a <app-name> # the buildpack doesn't work on the current default stack heroku-18, so we must downgrade git subtree push --prefix HelloWorld heroku master # heroku wants everything to be in the root directory, but I don't wanna heroku open
References are preserved as PDFs in
Issues and pull requests are welcome!
If this project helped you, please consider leaving a tip
Do you need help with a project? I'm currently available for hire or contract..