the-road-to-graphql / fullstack-apollo-react-boilerplate Goto Github PK
View Code? Open in Web Editor NEW๐ฅA sophisticated Apollo in React boilerplate project.
Home Page: https://roadtoreact.com
License: MIT License
๐ฅA sophisticated Apollo in React boilerplate project.
Home Page: https://roadtoreact.com
License: MIT License
We have "env.local" in our gitignore
file, but the app isn't using ENVs. For example, the GraphQL url is hardcoded.
The current routes.js class only holds constants value for various paths in the application, and thus would make far more sense to be named paths.js.
I'm pulling my hair out with this issue...
I'm using this component:
<ListAllTeamsData
data={data}
subscribeToMoreTeams={() => {
subscribeToMore({
document: LIST_ALL_TEAMS_SUBSCRIPTION,
updateQuery: (previousResult, { subscriptionData }) => {
console.log(previousResult, subscriptionData)
if (!subscriptionData.data) {
return previousResult
}
const { teamCreated } = subscriptionData.data
return {
...previousResult,
teams: [
...previousResult.teams,
teamCreated.team
],
}
},
})
}}
/>
And the scema:
export const LIST_ALL_TEAMS_SUBSCRIPTION = gql`
subscription {
teamCreated {
team {
name
id
status
mobile
}
}
}
`
It works fine when I run the subscription in the GraphQL playground, but I get the error in the app. I have no idea why. Any help? It won't even hit the console.log so there seems to be something wrong with 'document: LIST_ALL_TEAMS_SUBSCRIPTION', but from what I can tell it's all fine.
Was wondering how to get the previous page for given edges? Total count might make sense as well.
installed fullstack-apollo-express-postgresql-boilerplate with empty database.
installed this program (I did update the packages via a npm upgrade first).
it appears that the code doesn't expect a undefined session, and has no error checking to handle it.
I see the following on my graphql. (it shouldn't return any, it's empty)
Executing (default): SELECT "id", "text", "createdAt", "updatedAt", "userId" FROM "messages" AS "message" ORDER BY "message"."createdAt" DESC LIMIT 101; POST /graphql 200 40.866 ms - 405 POST /graphql 400 1.410 ms - - POST /graphql 400 2.909 ms - -
Hi all.
A really nice app but unfortunately I get the following error with session on landing page:
My package.json in client folder:
{
"name": "fullstack-apollo-react-boilerplate-project",
"version": "0.1.0",
"author": "Robin Wieruch [email protected] (https://www.robinwieruch.de)",
"dependencies": {
"apollo-cache-inmemory": "^1.3.7",
"apollo-client": "^2.4.4",
"apollo-link": "^1.2.3",
"apollo-link-error": "^1.1.1",
"apollo-link-http": "^1.5.5",
"apollo-link-ws": "^1.0.9",
"apollo-utilities": "^1.0.24",
"graphql": "^14.0.2",
"graphql-tag": "^2.10.0",
"history": "^4.7.2",
"react": "^16.6.0",
"react-apollo": "^2.2.4",
"react-dom": "^16.6.0",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.0",
"subscriptions-transport-ws": "^0.9.15"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom --passWithNoTests",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
My package.json in server folder:
{
"name": "fullstack-apollo-express-postgresql-boilerplate",
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "10.11.0"
},
"scripts": {
"start": "nodemon --exec babel-node src/index.js",
"test:run-server": "TEST_DATABASE=mytestdatabase npm start",
"test:execute-test": "mocha --require @babel/register 'src/**/*.spec.js'",
"test": "echo "No test specified" && exit 0"
},
"keywords": [],
"author": "Robin Wieruch [email protected] (https://www.robinwieruch.de)",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/register": "^7.0.0",
"axios": "^0.18.0",
"chai": "^4.2.0",
"mocha": "^5.2.0",
"nodemon": "^1.18.7",
"morgan": "^1.9.1"
},
"dependencies": {
"apollo-server": "^2.2.3",
"apollo-server-express": "^2.2.3",
"bcrypt": "^3.0.2",
"cors": "^2.8.5",
"dataloader": "^1.4.0",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"graphql": "^14.0.2",
"graphql-iso-date": "^3.6.1",
"graphql-resolvers": "^0.2.2",
"jsonwebtoken": "^8.4.0",
"pg": "^7.6.1",
"sequelize": "^4.41.2",
"uuid": "^3.3.2"
}
}
I'm working with node 8.11.2 on ubuntu 16.04.
Thanks and I'll appreciate any hint.
When connecting this client application to the Postgres application, I get the following error:
ApolloError.js:58 Uncaught (in promise) Error: Network error: Response not successful: Received status code 400 at new ApolloError (ApolloError.js:58) at Object.error (QueryManager.js:388) at notifySubscription (Observable.js:157) at onNotify (Observable.js:196) at SubscriptionObserver.error (Observable.js:253) at Object.error (index.js:77) at notifySubscription (Observable.js:157) at onNotify (Observable.js:196) at SubscriptionObserver.error (Observable.js:253)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.