Does this tutorial assume that I already have Apache setup and running? I’m unable to access localhost so I’m assuming that this may be the case. Either that, or I misconfigured something during a previous attempt at getting server side Swift up and running using another tutorial.
Hi, there. I found on my mac, that the process “httpd” was NOT running by using Activity Monitor and viewing all processes. I had never installed Apache on my box. So I don’t think I had Apache running on my mac, but I was able to start the server in Xcode and use Firefox to look at localhost:8080.
Greetings, Ray. I love all of your tutorials and have been a long time subscriber. But I felt I must comment on this one - it is just so good! I didn’t know about Vapor, but did have a little experience with Heroku for another web app I developed. Your introduction here was very clear and to the point. Setup instructions were right on and very helpful. I learned something new today and that makes me happy! That’s the reason I keep subscribing to you. I look forward to more about Vapor, especially how to integrate with databases. Thanks!
You don’t need Apache to use Vapor since it comes with a built in HTTP server.
It’s possible that you need to visit
http://127.0.0.1 depending on how your computer is configured.
great tutorial, can’t wait for whats coming …
Thank you, @rwenderlich !
I discovered vapor a couple of weeks ago, so was pleased to see this. I do the vast majority of my web work with Yii. But love Swift.
Although I’ve never used them, it seems to be quite like Node in the way it constructs web pages.
I’d also be interested to know about benchmarks for server-side swift vs other popular web languages or frameworks like:
Found a good benchmark article
The next step for me is now thinking about template engines and how one would go from here to integrate HTML (Mustache.swift)? and how to work with DBs?
@cdisdero @yoele @novoselov Thanks so much! :]
@jonny Heh funny you mention that - in my next Vapor screencast I’ll be covering templating, and in the next few screencasts after that I’ll be covering how to work with DBs. Hope it helps! :]
Plaintext benchmark on Go, Java, Swift, PHP and RubyonRails. I believe SSS is using sync on HTTP server, Vapor need asynchronous or better way as good as fasthttp (Go) to improve it. epoll or DispatchSource perhaps?
Netty and Vert.x uses Java NIO which is hellish fast!
That will be so cool, thank you for those and just this whole magical site. It has made my transition to from more Web based languages far easier
These articles’ results make a case for the Perfect framework
Perfect’s feature set is much more limited than Vapor’s. Perfect also depends on C code for HTTP parsing, where as Vapor is pure Swift. This could be what is causing Vapor to lag a bit in those tests.
That being said, those tests do not represent a real world use case. In almost any real application, you’ll be relying on a database which bottlenecks performance.
Additionally, going forward Apple is going to be releasing standardized networking components that all of these frameworks will adopt. At that point, they will all run at the exact same speed and it will be only the feature sets that matter.
Did you swap the Scheme from framework to app then build?
@alexhedley Yes you need to switch the scheme to App before building & running.
I run into the problem that either
if I set n for custom buildpack, I get an Error: fileOrDirectoryNotFound
or, when I set the buildpack to github.com/kylef/heroku-buildpack-swift, I get the same error.
I tried to combine another tutorial from appcoda, where the heroku git is set manually, but then it also cannot find the buildpack, with the following error:
-----> Failed to detect set buildpack [https://] github.com/kylef/heroku-buildpack-swift
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
Something is wrong in the automatic and manual buildpacks detection. What could it be?
Ah! Found it. It was caused by my lack of knowledge of heroku. Make sure your Vapor app is in the ROOT of you repository, else Heroku cannot find it.
I notice my structure is different to yours:
My souce folder has a whack of other folders in and then my “App” is at the bottom. Where/how did you rearrange yours? Thanks for the tutorial I just spun my Heroku app up!
@jonny Yes, this has changed since I wrote the tutorial - I haven’t dug into it, but I suspect the Swift Package Manager bundled with Xcode 8.1 changed this behavior.
In the screencasts I’m working on now, I just left things like this, with my App folder on the bottom. A tad annoying but it’s OK. I do like how all the packages are there now, because it makes it a lot easier to browse through the code and set breakpoints if necessary.
Ok, thanks for the reply!