Before implementing the server, we need to prepare a build environment for both OS X and Linux; also, let's prepare a HelloWorld
server, which handles a GET
and POST
request in a predefined URL.
The Swift open source version for OS X can be downloaded from https://swift.org/download/#latest-development-snapshots; however, because a new version is released every week, it could be too complicated to be aligned with the version.
Fortunately, taking inspiration from projects in different languages, such as PyEnv for Python, Kyle Fuller released a useful version manager for Swift called Swift Version Manager, which can install and manage different versions of Swift on the same machine, optionally tying a particular version of the language for each project.
The GitHub page of the project, https://github.com/kylef/swiftenv, shows different ways to install it, although I suggest that you do it via Homebrew using this...