Need a Meteor 2.0 + Apollo Server + Apollo Client + SSR Todos

Is there an official example? Thank you

you can use a boilerplate I wrote with @ivo : https://github.com/Gorbus/meteor-react-apollo-ssr
It’s not a todo list but SSR is fully working.

2 Likes

Very timely reply, as fast as meteor’s name, go see it now, thank you for sharing

2 Likes

I would like to ask you, this section of your code, the editor will report an error, so I made the following changes,

import { Meteor } from "meteor/meteor";

let Router = null;

if (Meteor.isServer) {
  import { StaticRouter } from "react-router-dom";
  Router = StaticRouter;
} else {
  import { BrowserRouter } from "react-router-dom";
  Router = BrowserRouter;
}

export default Router;

It will import StaticRouter and BrowserRouter on both the server and the client, will there be any problems? Obviously this will look a lot cleaner, but I’m not sure if it will, thank you

import {Meteor} from "meteor/meteor";
import {StaticRouter, BrowserRouter} from "react-router-dom";

export default Meteor.isServer ? StaticRouter : BrowserRouter;

It will increase the bundle size if you import both.
Why does the first is throwing an error ?
The first on should be working.

If you use the above method, the editor will report an error. If you use the following method, the front and rear ends will be loaded at the same time. The difference is here

If it’s just use, no problem. You’re right. Just want to discuss it. Cheers :crazy_face:

Strange I didn’t have any error with our original code.

It’s not an error, it’s an error in the code in the editor, just a hint, a hint, I use WebStorm

1 Like