I’ve built the project, I get an output that says everything is running. I’ve opened up a browser (Chrome) and its at the Kitura homepage for localhost:8080/acronyms, but when I type the curl commands, I get could not resolve host: localhost. What am I doing wrong? I’ve also tried this with the downloaded final project you provided and the same occurred.
Do you have any other services running on localhost:8080? My first guess would be to try updating the port in the App class to something different like 8090, and see if you get a different result.
Okay, I seem to have gotten it to work now. I was running a different Docker container but yours was not running. killed the other one, started yours and ran again in Xcode. I got back an empty database as I should have.
Are we not allowed to have different docker containers running?
Ok, so these logs indicate that CouchDB is not properly set up on your machine, or perhaps something else is taking up port 5984, which is the default port for CouchDB. This is because the logs indicate the database could not even be created. I’m curious as to why the Homebrew package installation seems to have failed for you, but nonetheless, it looks like the Docker approach worked.
You should be able to have different docker containers running, but it’s a matter of port availability. If you have multiple containers running, then that could create a collision somewhere, but it’s not likely if you know which containers you’re running and which ports you’re opening them to.
Let me know if you have further questions - I’m glad you got it up and running eventually!
Hi! I think Vapor is great, and it’s impressive to watch what Tanner, Logan, and the team have worked on.
I like Kitura because it’s modeled like Express.js, which is one of the most popular HTTP frameworks you will encounter in any language. Since that was the first non-Swift HTTP framework I encountered, it became natural to me to use it. Thus, using Kitura feels familiar to me by default.
It would be unfair of me to say anything educational about Vapor, but I can tell you that if you’ve ever used Express before, Kitura will seem familiar to you as well.
Above all, if you’re trying to choose, I’d advise you to try both. Having a choice is always a good thing, and most of the time, it comes down to personal preference.
If you’d like to ask more questions, feel free to sign onto our public slack at http://slack.kitura.io
Yes, it’s ready for production. That could easily be taken as opinion, but IBM, amongst others, are offering support for people running Swift APIs in their clouds.
I read your tutorial and got the same correct result. Now I want to know how we can generate the API with that which we can provide End user to consume. I have seen the API created but didn’t get how to distribute it to Front end.Can you please help on that or provide any reference regarding that?
Hi! So this is actually not necessary. One of the features of Codable Routing is that it knows the type of route you are expecting, and the mechanism to handle parameters included with the request detects one automatically.
If you we’re to use the v1.x way of routing in Kitura, you would need to include the /:id in the route at the end, to specify a parameter being mapped to the route.
I’m following the tutorial and I got this error:
[2018-06-28T14:17:07.738-03:00] [ERROR] [Application.swift:51 createNewDatabase()] Could not create new database: (Optional(“Error: unauthorized, reason: You are not a server admin.”)) - acronym routes not created
Should I set a username and password for my database?