Based on Cocoa with Love article: "A simple, extensible HTTP server in Cocoa". http://www.cocoawithlove.com/2009/07/simple-extensible-http-server-in-cocoa.html
This is a Swift version of HTTP server that is doing following:
- Opening a socket for listening
- Receiving incoming connections
- Handling response (returning 501)
There are two options to run HTTP Swift Server:
- Xcode: Open Xcode and run the project.
- Terminal: Run
swift main.swift
. This will execute Swift code. Make sure that Swift toolchain is added to the PATH.