3 ms·
>front-end features like form generation and HTML templating were really important, but now they're arguably better to avoid. Why is that?
by wandering2 10y ago
>front-end features like form generation and HTML templating were really important, but now they're arguably better to avoid.
Why is that?
- bdr 10y agoIt's the DRY principle. If you have a single-page app, the frontend needs to know how to render everything (using JS), so rendering on your backend as well is, at best, duplicated work. There may also be complications at the boundary of those regimes, like how your frontend initializes on top of server-rendered HTML.
- brianwawok 10y agoAt most 5% of apps should be a SPA. Seems rash to pick your only web framework on 5% of apps.
- viiralvx 10y agoNot OP but I feel like it's because JavaScript has evolved enough that some of the niceties they offered before doesn't make sense. I like using Ember.js and doing client-side validations is pretty darn easy without complicated JS. Additionally, having inherited a legacy Rails project that uses `remote: true` in it's forms, it is causing more of a headache to fix these legacy issues.
- senko 10y agoValidating data should always be done on the server. You should never, ever, trust the client. That's not to say you can't do (or shouldn't do) form rendering, processing, error/success handling, etc. on the client-side, but the server should always have the last word on the validity of what you send.