postgresql - setting up graphQL on OpenShift -


i'm learning how set server on openshift uses node, express, graphql , postgres , need help.

when trying set graphql server i've been following , works on local machine:

import express 'express'; import graphql 'express-graphql'; import schema './db/gqlschema';  const app = express();  app.use('/graphql', graphql({     schema: schema,     pretty: true,     graphiql: true })); ... 

i'm using server.js template provided openshift above changes to:

... self.app = express();  self.app.configure(function() {     self.app.use('/public', express.static(__dirname+'/public'));     self.app.use('/graphql', graphql({        schema: schema,        pretty: true,        graphiql: true     })); }); ... 

but doesn't work when pushed openshift. 'internal server error' instead of graphiql interface.

i'm new this, here guesses might have with:

  1. connecting database
  2. missing dependencies

    1. connecting database: have 2 json config files. 1 local machine connected using port-forward ssh tunnel openshift. works fine. other 1 production. in have strings database name, user, port, host, , password, openshift provided me. i'm using config library looks @ node_env decide config json file use. set node_env variable on openshift production. when query it, shows correct strings. there else need set?

    2. missing dependencies: keep neat, keeping back-end code separate front-end code. back-end code has express, graphql, sequelize, config, , pg stuff installed. need else make graphiql page work? also, put /node_modules/ in .gitignore file -- assumed openshift installs them post push. right thing do?

would appreciate help!

ok - solved doing following:

in openshift cli tools turn on error logs

rhc tail -a <yourappname> 

this give clues. in case message express-graphql "unresolved promise". after researching found if install , save es-promise , add line top of server.js file:

require ('es6-promise').polyfill(); 

hope helps else!


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -