Building a Vapor application from scratch

Before we start creating Vapor applications using the Vapor toolbox, which is an awesome tool provided by the Vapor team, let's see the minimal amount of code needed to create a Vapor application from scratch using the Vapor package. To do so, we need to follow the following steps:

  1. Create a new Hello folder and open it in the Terminal.
  2. Then, initialize the Swift package by running the init command, and make it an executable type. This should generate the Sources folder and Test folder, and also create a Package.swift file:
$ swift package init --type executable
  1. Update the dependencies section in Package.swift to include Vapor as a dependency, and also include Vapor in the target dependency for ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.