In writing a full stack To Do app for my own education, an Edutudu, I am going to start with a Vapor web service. This of course raises two questions: why start with a web service, and why Vapor?

The most well known Swift web frameworks right now are Vapor and Kitura. There are good comparisons around, and plenty of tutorials on each. Either is a good option. What sold me on Vapor is mostly Fluent, Vapor’s ORM framework. Vapor also has a command line tool that allows quick creation of an Xcode project to house the Vapor application.

This is the second reason I am starting with Vapor, though it is minor. Rather than create projects and integrate them later, I’m starting with the project generated by the toolbox, and will base a workspace off of it. There’s not a hugely compelling reason to do this, but I do need a place to start and this one option.

I’m going to be following the Vapor docs.

The first step is installing the Vapor Toolbox via Homebrew.

brew tap vapor/tap
brew install vapor/tap/vapor

Next we’ll create a new site:

vapor new EduTuDuWeb

And an Xcode project:

cd EduTuDuWeb
vapor xcode

Open the project, select the Run schema on My Mac, open http://localhost:8080/hello and there we are!

Hello, world!

Now, this isn’t all that much of an accomplishment. Following a recipe, using a tool, and having a template generate a project. But it’s a good start, and a base to begin with. Next time, we’ll start customizing.

I’m not yet sure it’s accurate, but I think of Vapor like a younger kind of Rails or Django, a framework and scaffolding for creating web applications quickly. I’m familiar with Ruby on Rails, so I’m hoping this is an easy leap to make.

Vapor has already given me a routes.swift with some routes defined, a model, and a controller. The funny thing is that the default model is called Todo. Either this means “to-do” as in, here’s a placeholder for your model, or To Do apps are a common Hello World. Maybe both. Maybe they knew I was on my way over.

I don’t yet have a database set up, and one point of my exercise is to pull common data structures together. So I’ll be adapting the Todo class in Part II.