Show HN: Open-source StackOverflow-like service(paizaqa.herokuapp.com) |
Show HN: Open-source StackOverflow-like service(paizaqa.herokuapp.com) |
A common optimization would be to preload the served javascript with the initial AJAX results. This still means rendering the content on the client side, but the content isn't fetched asynchronously. Another optimization is to actually render all the DOM elements in advance on the server, and only use client side rendering for updates.
Which is, you know, how the web is supposed to work.
The problem is it's still quite raw and full of demo-stuff. Not in the way it loads.
Although... yes, isn't Angular a bit overkill here?
Building a QA web service in an hour - MEAN stack development(3)
For me, the most important part is the language. I can use JavaScript for client side, server side, and database. There is no context switching related to language like Ruby, JavaScript, SQL. (And, the way of thinking related to that like asynchronous and synchronous.)
It is especially helpful for startup or prototyping where small team build everything.
No seriously, the askbot guys have been for a long time on the field, great app.
I even wrote a rails console-like equivalent for the older version[1]. Didn't get time to write a new one though. Will be a good addition to the generator I think.
Building a Q&A web service in an hour - MEAN stack development(3) http://engineering.paiza.io/entry/2016/03/10/115345
http://paizaqa.herokuapp.com/questions/show/56e1a5872c8dfa03...
Also, there was a issue on Social Login, I also fixed the issue.
<navbar></navbar>
Do you even know that this is invalid and the proper tag is called just <nav>? Do you know that <title> must not be empty in the initial page? Do you know that custom attributes must start with data- (not ng- or ui-)?
Did you even check your page with http://validator.w3.org?
I honestly don't understand how did the authors manage to make a skeleton (!) page not passing validation. Even <title> is empty when it must not be so.
Is it because of Angular? Well, if a framework forces you to write invalid HTML (tags, attributes, whatever), it sucks, no matter what.
What you really want to do is provide progressive enhancement where the first thing a user sees is usable and then more features become available without disrupting whatever the user has started doing (e.g. don't reflow the page while they're trying to read or browse). One way to achieve this is rendering the initial view on the server side and then doing updates via AJAX request but this has meant writing your rendering code twice, once on the server side and once on the client side. This is a reason that node.js and isomorphic JavaScript in general have become so popular.
> ...the drawback is that each time you refresh the view you have to resend all the markup. You're increasing the total amount of data that's going back and forth between the browser and the server.
For like 99.9% of applications this is a non-issue. For crying out loud, StackOverflow itself has been doing server-side rendering since day one and is still heaps and bounds more usable than WhateverTheHellIsTrendingOnHn.js-based single page isomorphic rich web applications.
It might be my age showing, but, while completely agreeing with you on "progressive enhancement all the way", I find that too freakin' much resources nowadays are spent doing and re-doing and re-inventing something that was working fine in the first place.
Let's begin from the end: generation. With a proper presentation layer, we wouldn't have to generate anything. We have data (from the server and/or local in-browser storage) and presentation modules, and we just feed data right into these modules on demand.
Next: HTML. In an ideal situation, we wouldn't touch any raw HTML string at all. Presentation modules, in effect, are responsible for DOM rendering of the page parts they are in charge of. And proper partial rendering usually doesn't involve innerHTML and other raw hacks (well, maybe for quickly clearing element contents, it will do). No escaping hell and other "fun" things.
Next: server-side. Screw all the dogmatic rules that the presentation layer must run on a server. The server should be responsible for handling all non-view logic providing the API for the client to communicate with (from simple AJAX/REST to something more complex like WebSockets) and serving our scripts and assets as fast as possible with proper caching headers, that's all.
This model, if applied wisely, will just make everything easier. I'm in the process of writing an article on it. But as I see Angular in this stack, this particular implementation doesn't show any sign of wisdom. :) Kill the overkill and keep it simple, stupid.