News for hackers. Stuff that matters.
Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by tsm on Tuesday February 14, 2017 @04:15PM (#13647252)
Vanilla forms just GET or POST to some server endpoint with all of the <input>s passed in as query parameters. Frameworks (e.g., Rails) put some syntactic sugar on it, but that's really all that's happening. If the form submission contains invalid input, it's customary to return to the form page (with all the values already filled out) and show a server-generated message about what went wrong.

JS is absolutely not required for any of it.

Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by GoodbyeEarl on Tuesday February 14, 2017 @07:42PM (#13648744)
Thank you! it is actually enlightening :)

I think it's a little bit awkward to not use put, patch, delete... I wonder however if my server must follow the same technique, if not how to wire a delete endpoint to handle a form post and so on. I'll try to handle a form using only get and post sometime just to see how it works. Thank you!

Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by flukus on Wednesday February 15, 2017 @02:29AM (#13650361)
Well you just made me feel old. For put/patch/delete you can just as easily wire different options to different URL's. We had URL's like /Foo/Delete?43. It may be awkward in a particular framework but it's about as simple as things get.

I've always hated put/patch/delete because it tends to result in data centric UI's instead of workflow centric ones.

Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by GoodbyeEarl on Wednesday February 15, 2017 @05:43PM (#13656119)
Here it is https://github.com/viniciusCamargo/express-crud-barebone here is my try on this approach to server requests. Any suggestion would be welcome! :)
Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by GoodbyeEarl on Wednesday February 15, 2017 @08:27AM (#13651815)
Hmm now that you mentioned I realized I've seen this pattern before but I've never given it a thought. I'll definitely try it sometime, it seems to work pretty well. BTW sorry for make you feel old, it was not my intention haha
Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by dzonga on Tuesday February 14, 2017 @11:25PM (#13649684)
I would really want to know more about this too, built a simple site without all that JS bloat
Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by GoodbyeEarl on Wednesday February 15, 2017 @08:41AM (#13651889)
I'm thinking about push some code to github this afternoon using these techniques with nodejs, if you want to I can send you a link to the repo ;)
Re:Craigslist Is Ugly, Janky, Old School, and Unbeatable by GoodbyeEarl on Wednesday February 15, 2017 @08:21AM (#13651780)
I'm glad for not being alone here :) I wish things were simpler...