Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
graphan committed Oct 19, 2016
1 parent ab275f9 commit be213f4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 29 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,19 @@ Best way to keep up to date is check the [issues](https://github.com/WeLikeGraph

1. Any suggestions/improvements/bugs can be in the form of Pull Requests, or creating an issue.
2. Coding guidelines: [Airbnb's Style Guide](https://github.com/airbnb/javascript)

I have already applied your hints. I just forked `react-apollo-example` and pushed [this commit](https://github.com/graphan/react-apollo-example/commit/4b0b8394d6eea335119d6d61af4e84295e660cdd). You can see that I use: http://graphql-swapi.parseapp.com. There are no any difference in the project despite the above commit.

When I run: `npm run build` and `npm run start`, then no errors.
However, when I reach `localhost:3000`, then I have the following error in the console:
```console
RENDERING ERROR: { [Error: Network error: Unexpected token <]
graphQLErrors: null,
networkError: [SyntaxError: Unexpected token <],
stack: 'Error\n at new t (/home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:7:13556)\n at /home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:31:28905\n at /home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:32:6321\n at Array.forEach (native)\n at /home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:32:6284\n at /home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:38:7557\n at i (/home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:38:7325)\n at m (/home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:38:8190)\n at e.broadcastQueries (/home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:32:6246)\n at e.broadcastNewStore (/home/tommyjs/Desktop/WLGQL/copy/react-apollo-example/dist/server.js:31:27393)',
message: 'Network error: Unexpected token <',
extraInfo: undefined }
```

What might be the root cause?
I use `[email protected]`. I installed also `[email protected]`, but the same error.
2 changes: 1 addition & 1 deletion app/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import App from 'App';

// rembmer to change this endpoint accordingly - here is no access to .env file
// ${HOST}:${GRAPHQL_PORT}/${GRAPHQL_ENDPOINT}
const networkInterface = createNetworkInterface('http://graphql-swapi.parseapp.com/');
const networkInterface = createNetworkInterface('http://localhost:8080/graphql');

const client = new ApolloClient({
networkInterface,
Expand Down
12 changes: 4 additions & 8 deletions app/components/Lang/Lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Lang = ({ language, changeLang, data }) => {
}

return (
<div></div>
<div>Lang</div>
);
};

Expand All @@ -35,13 +35,9 @@ const LangWithState = connect(
)(Lang);

const PageWithDataAndState = graphql(gql`
query allPlanets {
allPlanets {
edges {
node {
id
}
}
query allPosts {
posts {
id
}
}
`)(LangWithState);
Expand Down
12 changes: 4 additions & 8 deletions app/components/Menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ const Menu = ({ data }) => {
}

return (
<div></div>
<div>Menu</div>
);
};

const MenuWithData = graphql(gql`
query allPeople {
allPeople {
edges {
node {
id
}
}
query allPosts {
posts {
title
}
}
`, {
Expand Down
15 changes: 4 additions & 11 deletions app/components/Page/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,15 @@ const Page = ({ data }) => {
return (null);
}

const { posts } = data.wp_query;

return (
<div>
</div>
<div>Page</div>
);
};

const PageWithData = graphql(gql`
query allFilms {
allFilms {
edges {
node {
id
}
}
query allPosts {
posts {
votes
}
}
`, {
Expand Down
2 changes: 1 addition & 1 deletion app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dotenv.config();
const GRAPHQL_ENDPOINT = process.env.GRAPHQL_ENDPOINT || 'graphql';
const GRAPHQL_PORT = process.env.GRAPHQL_PORT || 8000;
const HOST = process.env.HOST || 'http://localhost';
const apiUrl = 'http://graphql-swapi.parseapp.com/';
const apiUrl = 'http://localhost:8080/graphql';

export default function render(req, res) {
const client = new ApolloClient({
Expand Down

0 comments on commit be213f4

Please sign in to comment.