sysgears / apollo-universal-starter-kit

Apollo Universal Starter Kit is a SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.
https://apollokit.org
MIT License
1.68k stars 323 forks source link

Using with remote graphql server #197

Closed kyzia551 closed 7 years ago

kyzia551 commented 7 years ago

What is the easiest way to change settings for using remote graphql server in you starter kit?

I've tried different ways, last try was in api_server change:

import proxy from 'http-proxy-middleware';

app.use('/graphql', proxy({target: 'http://localhost:8000', changeOrigin: true}));

But any time I receive "400, bad request" error, and have no idea, because server works fine.

mairh commented 7 years ago

@kyzia551 If you need to run your own server at a remote location then you need to some refactoring. What you need to do is to have the server running on a different node, which is not something plugged into this starter kit at this moment. This is a full blown full-stack kit.

If you are not up for doing some webpack refactoring then I can suggest you another starter kit which only supports react + apollo front end part (https://github.com/reactql/kit)

In the aforementioned kit, you can just plug in your remote GraphQL end point at this line https://github.com/reactql/kit/blob/master/config/project.js#L4 and you are good to go.

There is a CLI available for the kit if you prefer to use it instead cloning to ejected package https://github.com/reactql/cli

larixer commented 7 years ago

@kyzia551 Support for external GraphQL backend has been just added. Please fetch the latest source code for the starter kit from this repository and set serverConfig.url in tools/webpack.app_config.js to your GraphQL server endpoint

veeramarni commented 7 years ago

Webpack doesn't understand url if you uncomment it. Do you want me to create a separate issue?

configuration has an unknown property 'url'. These properties are valid:
 object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, modu
le?, name?, node?, output?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath
?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
larixer commented 7 years ago

@veeramarni Yes, please create separate issue and please provide reproduction steps, since it is not clear what npm script are you launching.