Swiftpack.co - Package - apparata/NetAppKit


SwiftPM compatible MIT License language Swift 5.1 platform macOS platform Linux

Framework for making Express-like net apps using Swift NIO.


NetAppKit is released under the MIT license. See LICENSE file for more detailed information.

Table of Contents

Getting Started

Add NetAppKit to your Swift package by adding the following to your Package.swift file in the dependencies array:

.package(url: "https://github.com/apparata/NetAppKit.git", from: "<version>")

If you are using Xcode 11 or newer, you can add NetAppKit by entering the URL to the repository via the File menu:

File > Swift Packages > Add Package Dependency...

Note: NetAppKit requires Swift 5.1 or later.

Reference Documentation

There is generated reference documentation available.


import Foundation
import NetAppKit

let app = App()

app.handle(.GET, path: "/helloworld") { (request, response) in
    response.send("This is a test.")
    return .handled

app.handle(.GET, path: "/echo/:word") { (request, response) in
    response.send("Echoed word: \(request.parameter("word"))")
    return .handled

// Subapp that is installed on /date, so /today endpoint will be /date/today
let subapp = App()

subapp.handle(.GET, path: "/today") { (request, response) in
    response.send("Today's date is \(Date())")
    return .handled

app.installSubapp(subapp, path: "/date")

do {
    let server = AppServer(app: app)
    try server.listen(on: 4000)
} catch {


Stars: 1


Used By

Total: 0


Bug fix for API-Key validation - 2019-10-28 18:14:31

Added optional closure to App for validating API-Key field. - 2019-10-27 18:26:09

Added an optional closure property to App for conveniently validating values of a API-Key header.

app.validateAPIKey = { (apiKey: String) -> Bool in
    apiKey == "MySecretAPIKey"

Fixed bug in JSONValue - 2019-10-02 20:49:28

Added JSONValue enum for convenience when creating simple responses - 2019-10-02 20:16:33

Added query items to HTTPRequest parameters. - 2019-08-31 12:13:58

Added convenience method for responding with JSON from Encodable objects - 2019-08-25 00:01:07

Now compiles on Linux - 2019-08-24 22:02:11

Fixed documentation theme. - 2019-08-24 21:36:32

Added subapps - 2019-08-24 21:23:56

Initial pre-release version. - 2019-08-19 23:09:58