Skip to content

Hello, world

This guide will take you step by step through creating a new Vapor project, building it, and running the server.

If you have not yet installed Swift or Vapor Toolbox, check out the install section.

New Project

The first step is to create a new Vapor project on your computer. Open up your terminal and use Toolbox's new project command. This will create a new folder in the current directory containing the project.

vapor new hello -n

Tip

The -n flag gives you a bare bones template by automatically answering no to all questions.

Once the command finishes, change into the newly created folder and open Xcode.

cd hello
open Package.swift

Build & Run

You should now have Xcode open. Click the play button to build and run your project.

You should see the terminal pop up at the bottom of the screen.

[ INFO ] Server starting on http://127.0.0.1:8080

Visit Localhost

Open your web browser, and visit localhost:8080/hello

You should see the following page.

Hello, world!

Congratulations on creating, building, and running your first Vapor app! 🎉