lvarayut / relay-fullstack

:point_up::running: Modern Relay Starter Kit - Integrated with Relay, GraphQL, Express, ES6/ES7, JSX, Webpack, Babel, Material Design Lite, and PostCSS
https://lvarayut.github.io/relay-fullstack/
MIT License
985 stars 126 forks source link

problem with replacing django backend with provided express #33

Closed imzautomation closed 8 years ago

imzautomation commented 8 years ago

hello i am using relay fullstack as frontend , i have developed the backend in django using graphene and i am serving a graphql endpoint from http://localhost:8000/graphiql here is my error log

module.js:442
    throw err;
    ^

Error: Cannot find module '/back/schema'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (babelRelayPlugin.js:2:14)
    at Module._compile (module.js:541:32)
    at loader (/home/imran/emberredbox/relay-fullstack/node_modules/babel-register/lib/node.js:148:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/imran/emberredbox/relay-fullstack/node_modules/babel-register/lib/node.js:158:7)
    at Module.load (module.js:458:32)

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'update' ]
2 info using npm@3.10.6
3 info using node@v6.2.2
4 verbose run-script [ 'preupdate', 'update', 'postupdate' ]
5 info lifecycle relay-fullstack@1.0.0~preupdate: relay-fullstack@1.0.0
6 silly lifecycle relay-fullstack@1.0.0~preupdate: no script for preupdate, continuing
7 info lifecycle relay-fullstack@1.0.0~update: relay-fullstack@1.0.0
8 verbose lifecycle relay-fullstack@1.0.0~update: unsafe-perm in lifecycle true
9 verbose lifecycle relay-fullstack@1.0.0~update: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/imran/emberredbox/relay-fullstack/node_modules/.bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/imran/emberredbox/relay-fullstack/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle relay-fullstack@1.0.0~update: CWD: /home/imran/emberredbox/relay-fullstack
11 silly lifecycle relay-fullstack@1.0.0~update: Args: [ '-c', 'babel-node server/utils/updateSchema.js' ]
12 silly lifecycle relay-fullstack@1.0.0~update: Returned: code: 1  signal: null
13 info lifecycle relay-fullstack@1.0.0~update: Failed to exec update script
14 verbose stack Error: relay-fullstack@1.0.0 update: `babel-node server/utils/updateSchema.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:852:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid relay-fullstack@1.0.0
16 verbose cwd /home/imran/emberredbox/relay-fullstack
17 error Linux 4.4.0-34-generic
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "update"
19 error node v6.2.2
20 error npm  v3.10.6
21 error code ELIFECYCLE
22 error relay-fullstack@1.0.0 update: `babel-node server/utils/updateSchema.js`
22 error Exit status 1
23 error Failed at the relay-fullstack@1.0.0 update script 'babel-node server/utils/updateSchema.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the relay-fullstack package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     babel-node server/utils/updateSchema.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs relay-fullstack
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls relay-fullstack
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
imzautomation commented 8 years ago

here are all the modification i have made https://gist.github.com/imzautomation/dc03dae0c10f24f148575744955cc60d

lvarayut commented 8 years ago

Thanks for clarifying your question. The error seems to be the var schema = require('/back/schema');, the compiler can't find the module. I guess you might need to use a relative path instead of the absolute path, for example, var schema = require('back/schema');

imzautomation commented 8 years ago

@Ivarayut thanks I changed the path as suggested the server starts and when I go to graphql endpoint I don't see my django schema I see the schema from data folder , how do I connect my django graphql server to this app ? My django graphql is serving from http://localhost:8000/graphql and my schema.json is in back folder

lvarayut commented 8 years ago

Unfortunately, I have never used Django before, can't really help you much. You might try to test your schema with GraphiQL. If it worked, the problem would be your Django setup. If not, the problem might be your schema.json.

lvarayut commented 8 years ago

I'm going to close this issue for now. Please feel free to continue the discussion here if you had more question.

crucialfelix commented 8 years ago

I got them working and wrote up notes here: https://gist.github.com/crucialfelix/2b94528bf0817dfefe1c3258977fa478

lvarayut commented 8 years ago

Thanks @crucialfelix for sharing this brilliant notes! Would you mind to put the notes inside our Relay Fullstack repository, would be inside docs/how-to-integrate-graphene-django.md? It would be very useful to many people.

imzautomation commented 8 years ago

@crucialfelix @lvarayut exactly what i was looking for thanks alot

crucialfelix commented 8 years ago

Yes, let me flesh it out a bit more. I figured out how to do the viewer { }. I want to get it up and running properly, then I will submit a PR for you.

crucialfelix commented 8 years ago

Oh wait, you don't have a docs/

Where would you like me to put it ?

lvarayut commented 8 years ago

Could you create it at the root directory and put the doc there?

On Sunday, October 30, 2016, Chris Sattinger notifications@github.com wrote:

Oh wait, you don't have a docs/

Where would you like me to put it ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lvarayut/relay-fullstack/issues/33#issuecomment-257144304, or mute the thread https://github.com/notifications/unsubscribe-auth/AEFWH1qIy8-pvHVqlfpHzyrEhbfH-rooks5q5He5gaJpZM4JrLH5 .

crucialfelix commented 8 years ago

Sure if you like. Or you could use the wiki pages for extra docs. As you like

On Sun, Oct 30, 2016, 12:31 Varayut Lerdkanlayanawat < notifications@github.com> wrote:

Could you create it at the root directory and put the doc there?

On Sunday, October 30, 2016, Chris Sattinger notifications@github.com wrote:

Oh wait, you don't have a docs/

Where would you like me to put it ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/lvarayut/relay-fullstack/issues/33#issuecomment-257144304 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AEFWH1qIy8-pvHVqlfpHzyrEhbfH-rooks5q5He5gaJpZM4JrLH5

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lvarayut/relay-fullstack/issues/33#issuecomment-257145757, or mute the thread https://github.com/notifications/unsubscribe-auth/AANWcsnMtZC0sevCkXeW7pWt6K6FyP3Bks5q5IAUgaJpZM4JrLH5 .

lvarayut commented 8 years ago

Thanks @crucialfelix, docs/how-to-integrate-graphene-django.md would be fine with me.