Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument number mismatch in demo code? #35

Closed
simonprickett opened this issue Dec 3, 2015 · 2 comments
Closed

Argument number mismatch in demo code? #35

simonprickett opened this issue Dec 3, 2015 · 2 comments

Comments

@simonprickett
Copy link

I'm new to both Swift coding and Taylor, been trying to get the example program to run and I keep getting:

server.swift:6:2: error: contextual type for closure argument list expects 3 arguments, but 2 were specified
        req, res in

with my code being:

import Taylor

let server = Taylor.Server()

server.get("/") { 
    req, res in
    res.bodyString = "Hello, world!"
    return .Send
}

let port = 3000
do {
    print("Starting server on port: \(port)")
    try server.serveHTTP(port: port, forever: true)
} catch {
    print("Server start failed \(error)")
}

Just wondering what I'm doing wrong here, I can't work out what any missing parameter would be from reading the Taylor source code right now.

@Danappelxx
Copy link
Collaborator

Ah - sorry for the confusion. We haven't had the chance to tag a release for the new usage, but already updated the README. You have two options:

  1. Update your version of Taylor by adding either "master" to the end of the line of your Cartfile, or adding :branch => "master" in your Podfile, depending on which one you're using.
  2. Use the old usage, which is actually:
server.get("/") { req, res, cb in
  // ...
  cb(.Send(req, res))
}

but I wouldn't bother with it since a new release will be tagged asap.

Sorry for the inconvenience.

@simonprickett
Copy link
Author

No problem, thanks for clarifying I'll go with the master option in the Cartfile. - working great now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants