Prisma1: Server-side rendering (SSR)

Created on 5 Oct 2016  路  6Comments  路  Source: prisma/prisma1

React apps can use libraries such as isomorphic-relay to get server-side rendering for the initial page render. However such libraries require running on a dedicated GraphQL server, but there is no such server when using graph.cool as a backend. It would thus be great for graph.cool to provide these HTML and JS pre-rendering endpoints.

Most helpful comment

I think this isn't something we would directly build into our system but rather make it really easy to put some kind of proxy in front of your web app. We'll look into that over the next couple of weeks and see what kind of solution we can present by then!

Keep posting these great proposals! :shipit:

All 6 comments

I think this isn't something we would directly build into our system but rather make it really easy to put some kind of proxy in front of your web app. We'll look into that over the next couple of weeks and see what kind of solution we can present by then!

Keep posting these great proposals! :shipit:

The way I explore this currently is with Next.js: it provides a kind of isomorphic app with SSR, which I configured to talk to Graph.cool using Apollo (both on the server and browser sides). With such a solution, no need to do anything more on Graph.cool side 馃憤 but maybe others would want a single server.

Thanks for the update @sedubois. We'll reach out to you to see how we could simplify this process further for other customers. We'll write an update here as soon as available.

I've been continuing to simply use Next.js for this. Maybe this could just be closed.

For further reference, these are projects with SSR using nextjs and Graphcool:
https://github.com/zeit/next.js/tree/master/examples/with-apollo
https://github.com/relatenow/relate

Other frameworks also support this, for example Vue: https://vuejs.org/v2/guide/ssr.html

As a sidenode on this matter: for VUE2 users vue-apollo is being able to fetch through apolloClient the queries server side as well. isomorphic-fetch is the only requirement to make this work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marktani picture marktani  路  3Comments

dohomi picture dohomi  路  3Comments

schickling picture schickling  路  3Comments

marktani picture marktani  路  3Comments

sorenbs picture sorenbs  路  3Comments