sergei-zelinsky/cra-ssr-boilerplate

No dinamyc urls,

Gonzalo2683 opened this issue · 2 comments

The routes are fixed by hand and do not contemplate content with dynamic url

Hi @Gonzalo2683!

The main idea which I tried to demonstrate in this repo is how to deal with SEO-friendly URLs, code-splitting, react-router v4 and of course SSR in the scope of Create React App without ejecting.

Imagine that we have a huge amount of pages with URLs which are not structured in REST style, like /pages/42, where 42 - is some page id column in DB, but we have something like this /some-page-title or /another-interesting-page-title and these URLs are corresponding to the different pages in our application.

Corresponding between URLs and appropriate pages are stored in our DB, as a result, we have to fetch our API server to get information about some page by its URL.

This repo doesn't contain a code for API server, but we simulate this behavior by the mocked fetch responses with information about URL (page and locale in our example).

After we receive information about URL (page, locale) we match this page to the component which is the representation of the page.

Here are mocked API server responses for some test URLs and page-to-component map.

@Gonzalo2683, do you have any questions or I can close this?