Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
jony neuemonic
Nov 13, 2009

abraham linksys posted:

[*] PushState routing. This is more advanced, and involves your router pushing new "pages" into the history using the HTML5 history API. This will give you what appear to be the same as a server-side URL, like myapp.com/foo, with no hash. The downside is that, if you've architected a "single-page" app where your application is represented in only a single server-side HTML page, your server's router will need to always send you to the same page, regardless of the URL. So the tradeoff is prettier URLs for a bit more server-side configuration[/list]
All three of the major frameworks can be configured to use either of these modes. Hash routing has better browser support, and is usually used as a fallback if you set up PushState routing.

Is this the same thing people have been doing with mod_rewrite for ages, or am I misunderstanding?

What's a typical back-end look like for one of these apps, anyway? Are they pretty minimal, or are you basically just spitting out JSON instead of rendering a view? I'd like to start doing more client-side stuff because I actually like writing JS (weird, I know) but I'm pretty lost with how it all fits together.

Adbot
ADBOT LOVES YOU

jony neuemonic
Nov 13, 2009

abraham linksys posted:

You can do pretty much anything you want on the back-end, but the flow is different. It's a bit tricky to explain without pulling out OmniGraffle, but instead of "Server-side route -> get data in a controller -> put that data in a server-side view -> output rendered HTML," your flow becomes "server-side route goes to your single-page app -> client side route figures out what data needs to be retrieved -> ajax call to your server -> return as json -> pull into your models/controller -> render in your client-side template" (with a few other layers mixed in for good measure).

That actually makes a lot of sense, OmniGraffle or no. Thanks!

jony neuemonic
Nov 13, 2009

Tutsplus posted an entire Ember course for free. No idea what the quality is like, but it might be worth watching:

http://freecourses.tutsplus.com/lets-learn-ember/index.html

jony neuemonic
Nov 13, 2009

What's the best way to share templates between Rails and JS? I see a few gems for using Mustache in rails but they look like they're for Rails 3.X

jony neuemonic fucked around with this message at 22:52 on Oct 18, 2013

jony neuemonic
Nov 13, 2009

Pollyanna posted:

:psyduck: Whoops I got that wrong then. What I was thinking of was some sort of tool that's basically a text field, then a list of text fields with an associated integer, then a table of variable rows, then a radio button or something. Would it make sense to try and MVC that or is that better done through plain HTML?

You're bringing a machine gun to a knife fight. You don't need to apply a design pattern or bring in a JS framework to make an HTML form.

jony neuemonic
Nov 13, 2009

Yeah. I could be misunderstanding (I'm almost entirely a back-end guy), but I can't see that you would ever want to expose DB credentials to a web browser. Where are you calling out to your DB from?

jony neuemonic
Nov 13, 2009

Pseudo-God posted:

Like I said earlier, apparently it's not possible to do this entirely in front-end JS. However, it may be possible to have a tiny PHP/ASP/node/ruby etc script, which can hold authentication data, and act as a relay to the external DB.

This is a perfect use-case for a micro framework. Pick whichever one matches your language of choice, wire up some simple routes, and you're done.

Adbot
ADBOT LOVES YOU

jony neuemonic
Nov 13, 2009

The Dark Wind posted:

Does anyone have experience with https://reactforbeginners.com/? I saw it recommended highly somewhere, but I'm hesitant to plop down :20bux:x3 unless a few other people have good things to say.

I enjoyed it, it's a quick watch but he covers a lot of useful things. Some of his other courses are free (Learn Redux and JavaScript30, maybe others) so you could always skim one of those to see if you like the style.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply