graphile / crystal

🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more!
https://graphile.org/
Other
12.63k stars 572 forks source link

Print postgraphql response logs with Express #531

Closed safaiyeh closed 6 years ago

safaiyeh commented 7 years ago

How can I implement this?

benjie commented 7 years ago

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

amizz commented 7 years ago

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);
benjie commented 6 years ago

[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 )