Mar 06, 2017: ~ 6 min read

The first post in the Server Side Swift series will be about initializing the project, its structure, and configuring your Droplet. Running the vapor xcode -y command (although I always run swift build first) will download dependencies, build them, configure an Xcode project, and you will end up with a structure like this:

vapor clean will delete everything in your Packages folder, in case you'd like to rebuild everything.

The Config/secrets folder should contain all your private configurations.

After setting your project up, adding a folder inside Tests will require another vapor xcode -y call, so the proper target(s) is created.

In Xcode
the Sources group will contain all the packages, along with what you put there.
all the folders inside the Tests folder will be imported under the same name, but, test targets with the same name will be created as well, so name them accordingly.

Here is the official Folder Structure documentation from Vapor; I'm sure it does a better job at explaining things than I did.

Finally, let's quickly cover the droplet. The first file you get after creating your project is main.swift, that initializes a Droplet, and offers a route example. I took a different approach, and created two methods in an extension that configure the Droplet, so that I can test them: