Postgraphile: Print postgraphql response logs with Express

Created on 26 Jul 2017  ยท  3Comments  ยท  Source: graphile/postgraphile

How can I implement this?

โ” question

Most helpful comment

Using ExpressJS

const express = require('express');
const app = express();
const postgraphql = require('postgraphql').postgraphql;
const morgan = require('morgan');

app.use(morgan('dev'));
app.use(postgraphql(POSTGRES_CONNECTION, SCHEMA_NAME, OPTIONS);

All 3 comments

You can mount PostGraphQL as an express middleware, so just do that after you mount the logging middleware

Using ExpressJS

const express = require('express');
const app = express();
const postgraphql = require('postgraphql').postgraphql;
const morgan = require('morgan');

app.use(morgan('dev'));
app.use(postgraphql(POSTGRES_CONNECTION, SCHEMA_NAME, OPTIONS);

[semi-automated message] To keep things manageable I'm going to close this issue as I think it's solved; but if not or you require further help please re-open it. (Thanks @amizz )

Was this page helpful?
0 / 5 - 0 ratings

Related issues

calebmer picture calebmer  ยท  3Comments

k-ogawa-1988 picture k-ogawa-1988  ยท  3Comments

giacomorebonato picture giacomorebonato  ยท  3Comments

5argon picture 5argon  ยท  4Comments

tazsingh picture tazsingh  ยท  3Comments