Install Toolbox¶
Vapor's command line interface provides shortcuts and assistance for common tasks.
Installation (macOS): Install → macOS
Installation (Ubuntu): Install → Ubuntu
Help prints useful information about available commands and flags.
vapor --help
You can also run the --help
option on any Toolbox command.
vapor new --help
The --help
flag should be your goto for learning about the toolbox as it is the most up-to-date.
New¶
The Toolbox's most important feature is helping you create a new project.
vapor new <name>
Just pass the name of your project as the first argument to the new
command.
Note
Project names should be PascalCase →, like HelloWorld
or MyProject
.
Templates¶
By default, Vapor will create your new project from the API template. You can choose
a different template by passing the --template
flag.
Name | Flag | Description |
---|---|---|
API | --template=api |
JSON API with Fluent database. |
Web | --template=web |
HTML website with Leaf templates. |
Auth | --template=auth-template |
JSON API with Fluent DB and Auth. |
Info
There are lots of unofficial Vapor templates on GitHub under the vapor
+ template
topics →.
You can use these by passing the full GitHub URL to the --template
option.
Build & Run¶
You can use the toolbox to build and run your Vapor app.
vapor build vapor run
Tip
We recommend building and running through Xcode if you have a Mac.
It's a bit faster and you can set breakpoints!
Just use vapor xcode
to generate an Xcode project.
Updating¶
The toolbox should be updated by the package manager it was installed with.
Homebrew¶
brew upgrade vapor
APT¶
sudo apt-get update sudo apt-get install vapor