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

Hello, World example doesn't seem to work :( #44

Open
jhoughjr opened this issue Jan 29, 2016 · 3 comments
Open

Hello, World example doesn't seem to work :( #44

jhoughjr opened this issue Jan 29, 2016 · 3 comments

Comments

@jhoughjr
Copy link

The Hello, World example isn't working at all for me.

my code in app delegate, pasted from the docs:
`import Cocoa
import Taylor

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

@IBOutlet weak var window: NSWindow!


func applicationDidFinishLaunching(aNotification: NSNotification) {

    let server = Taylor.Server()

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

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

`

The error is : Contextual type for closure argument list expects 3 arguments, but 2 were specified.
I've tried for quite a while to get the format of the closure correct but to no avail. where can I find a working example so I can start using this?

@Danappelxx
Copy link
Collaborator

Hey there! It seems as though you're using the latest release instead of the master branch. Unfortunately development stalled in the middle of a large refactor, so although we updated the readme we didn't tag a new release. For now you can use the example in the readme from the previous release here.

let server = Taylor.Server()

server.get("/") {
    req, res, cb in

    res.bodyString = "Hello, world!"
    cb(.Send(req, res))
}

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

@jhoughjr
Copy link
Author

jhoughjr commented Feb 7, 2016

I thought I had responded to this earlier, thanks for the assistance.
I look forward to this project growing!

@gabhi
Copy link

gabhi commented Feb 14, 2016

Thanks @Danappelxx

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

3 participants