Closed stefan1968 closed 6 years ago
I used express in this way the problem is that I do not know how to call the graphql scheme generated by postgraphile
const express = require("express"); //consr {Pool} = require("pg") const bodyParser = require("body-parser"); const { postgraphile } = require("postgraphile")
/if(process.env.NODE_ENV !== "production"){ require("dotenv").load() }/
const DB = "postgres://USER:password@localhost:port/database" const SCHEMA = "nameSquema"; const PORT = port;
const app = express();
app.use(postgraphile(DB, SCHEMA, { //Habilitar graphiql: true, //Agregar nuevas funcionalidades a graphiql enhanceGraphiql: true, //El punto donde graphiql escucha graphiqlRoute: '/', //Postgraphile actualiza la api de graphql watchPg: true, //Se presenta como cadenas (codificadas JSON) desde el esquema GraphQL dynamicJson: true } ));
app.listen(PORT, () => console.log("π π π Example app listening on port "));
You can access graphiql at http://localhost:${port}/ and graphql is at the same URL with /graphql on the end.
This times out and refuses to connect, can't fetch schema etc.
Error: connect ETIMEDOUT 34.234.132.151:5432 at Object._errnoException (util.js:1024:11) at _exceptionWithHostPort (util.js:1046:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
Change it to postgraphql, works fine. i.e const { postgraphql } = require('postgraphql') works fine.
When i did sort of get it working, the authenticate example kept throwing up the error 'ROW EXPANSION VIA * NOT ALLOWED HERE'
So, currently can't use the authenticate example on postgraphile, and can't use postgraphile in express.