Skip to content

server.start() doesn't actually do anything #376

@jalavosus

Description

@jalavosus

When trying to run the following code (more or less copied from the readme)

import Swifter
import Foundation

func createServer() -> HttpServer {
  let server = HttpServer()

  server["/hello"] = { request in .ok(.text("Hey")) }

  return server
}


let myServer = createServer()
try myServer.start()

The HTTP server doesn't actually start. Like, I can run swift build just fine, but actually executing the compiled binary just starts and exits normally. I would assume this isn't supposed to happen, but I can't find anything in the documentation about how one should actually start the server (the documentation also fails to mention that you need to have try before server.start()).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions