good one, as usual
although, in the implementation of
deleteAcronym), I’d rather just return the value of a call to
indexView instead of the redirect, so basically
just a personal choice / opinion thing, I guess
Thank you @rwenderlich great tutorial,
it would be great if you can make an advanced course on Vapor .
Have a good one
Awesome tutorials! Advanced course on Vapor would be incredibly beneficial. How to make it secure, advanced interaction with database and etc. Thank you so much!
@goranche Thanks! There is one advantage to using the redirect though (which I should have mentioned in the video)! :]
Imagine you don’t redirect, and
return try indexView(request: request) instead. Then when you add an acronym, your browser is displaying the result of the POST to
/til, and if you refresh the page, the browser effectively tries to re-post the same acronym (which isn’t desired; really the user probably just wants to refresh the latest list of acronyms). You get a warning like this:
Similarly, in the deleting an acronym case, the browser is displaying the result of a POST to
And if you refreshed the browser, it would try and delete that acronym instead.
By redirecting to
index, if you refresh the page it doesn’t try to re-add or delete anything. I hope that makes sense, and thanks for pointing this out as I’ll be sure to mention this if I ever cover this again! :]
@yoele @booorisss Thanks for your kind words and suggestions! :]
huh hadn’t thought of that, but yes, you’re right
hope you didn’t waste too much time trying it out
Thanks for another tut, we’re building up a nice website now.
Thanks Ray. You are awesome. From Peru!!!
Another app made with vapor
Code is on GitHub to see how it’s done
Cool, thanks for pointing this out @alexhedley!
How can we return different Response for different consumers in controller class, like I want to return below response for web-site
return Response(redirect: "/v1/student")
and different response for mobile apps like below
return try JSON(node: [
"error" : false,
"message" : "Student added successfully"
I am not getting how to achieve this.
Hi, did anyone come across this error when playing the video “The media could not be loaded, either because the server or network failed or because the format is not supported.”? I tried both Chrome and Safari.
@chwang I just tried and it’s loading OK for me, and haven’t heard of anyone else w/ issues. Maybe check your connection?
@rwenderlich you are right, it was my connection issue, thanks!
Great series. Can we possibly organize the videos into a playlist so we can follow them in the right order.