Now that you've installed Vapor, let's create your first Vapor app! This guide will take you step by step through creating a new project, building, and running it.
The first step is to create a new Vapor project on your computer.
For this guide, we will call the project
Open up your terminal, and use Vapor Toolbox's
vapor new Hello --branch=beta
At the time of this writing, Vapor 3 is not officially released. You can omit the
--branch=beta flag once 3.0.0 is released.
Once that finishes, change into the newly created directory.
Generate Xcode Project¶
Let's now use the Vapor Toolbox's
xcode command to generate an Xcode project.
This will allow us to build and run our app from inside of Xcode, just like an iOS app.
The toolbox will ask you if you'd like to open Xcode automatically, select
Build & Run¶
You should now have Xcode open and running. Select the run scheme from the scheme menu, then click the play button.
You should see the terminal pop up at the bottom of the screen.
Server starting on http://localhost:8080
Open your web browser, and visit localhost:8080/hello →
You should see the following page.
Congratulations on creating, building, and running your first Vapor app! 🎉