Server Side Swift with Vapor · Hello World | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/870225-server-side-swift-with-vapor/lessons/2

Hi,

I have a message “Safari can’t connect to localhost”. I tried with chrome, and I tried with replacing localhost by 127.0.0.1, I still have the same message. My firewall is off, any ideas about what could provoke this message ?
Ps. I’m on a macbook, everything is up to date

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

1 Like

Just figured it out, I did not pick the run-scheme, but the HelloVapor-Package…

1 Like

If you have problem creating the xcode project, just run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer, before vapor xcode…

1 Like

@jankubny Thank you for sharing this - much appreciated! :]

even after ruuning

sudo xcode-select-s/Applications/Xcode.app/Contents/Developer

this command i am getting the error

Generating Xcode Project [Failed]
error: terminated(72): xcrun --sdk macosx --find xctest output:
xcrun: error: unable to find utility “xctest”, not a developer tool or in PATH

Error: Could not generate Xcode project: error: terminated(72): xcrun --sdk macosx --find xctest output:
xcrun: error: unable to find utility “xctest”, not a developer tool or in PATH

Do you have Xcode installed and installed at /Applications/Xcode.app?

And can you post the exact command you ran? You seem to be missing some spaces

1 Like

Akshays-MacBook-Air-2:HelloVapor akshaydevkate$ Sudo xcode-select-s/Applications/Xcode.app/Contents/Developer
Sudo: xcode-select-s/Applications/Xcode.app/Contents/Developer: command not found

it is saying command not found

this helped i was missing some space between -s and /Applications

Vapor has changed a small bit since the publishing of this video.
If you are using Vapor 4.29+, check out the following Vapor Docs link on how Routes are now handled.

tl;dr

	app.get("hello", ":name") { req -> String in
		let name = req.parameters.get("name") ?? ""
		return "Hello, \(name)!"
	}

Yep it has, updating the video course is on the todo list after the book!

Nice! Keep rockin’

I just saw an update drop yesterday on the book?

Yeah early access is now out, will be a little while until the whole book is updated (waiting on Leaf!)