#1590 Merged at 6cceced
Repository
mwiencek
Branch
react-server
Repository
metabrainz
Branch
beta
Author
  1. mwiencek
Reviewers
Description

This pull request renders our 404 page with react.

The basic flow of operations is this:

There's a small node server (root/server.js) that takes a request like GET /root/main/404 plus a JSON body, and renders root/main/404.js with it.

On production servers, we'll probably run root/server.js as a separate daemontools service (configurable via DBDefs), but for development purposes, app.psgi will take care of forking/exec'ing it if it's not already running.

In the catalyst side of things, when initially handling a request, it checks if the requested action has a NewTemplate attribute. If it does, it calls out to MusicBrainz::Server::Renderer::handle_request, which takes care of communicating with server.js and setting the response body.

That's the overview anyway, I'll leave some more comments below.

Comments (5)

  1. mwiencek author

    I've updated this pull request to fix a bunch of conflicts and make the i18n stuff work, since apparently it didn't before. Instead of trying to use Jed on the server, it now uses node-gettext and reads the .mo files directly.

  2. Roman Tsukanov

    Works fine on my local server. And I guess that plan is to convert all template rendering to use this pipeline, as you described to me before? What's next after this?

    1. mwiencek author

      Thanks for testing it. :D Yes, I hope for this to be the future of all of our templates. As for what's next, I'm not 100% sure, but it'll probably be another small page that isn't critical to operation of the website. Small because we'll end up needing to port a ton of TT macros with it anyway. If I convert most of those macros in the smaller PRs, it'll make the bigger pages easier to port and review later. Non-critical because we don't know what problems this'll have in production yet.