graphql/express-graphql

[Proposal] Split into multiple middlewares

オープン

#113 opened on 2016/08/11

 (14 件のコメント) (21 件のリアクション) (0 人の担当者)JavaScript (482 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (5,319 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Just a idea, but I think we should embrace express middleware system.

Maybe something like below:

import { parser, validate, execute, errorHandler, graphiql } from 'express-graphql';
import logger from 'graphql-third-party-query-param-logger';

const app = express();

app.use('/graphql', parser(...));
app.use('/graphql', logger(...));
app.use('/graphql', validate(...));
app.use('/graphql', execute(...));
app.use('/graphql', errorHander(...));
app.use('/graphql', graphiql(...));

app.listen(3000);

And then we can use middlewares at any points to log and measure performance, even have more control on input, output and errors.

Eventually, more reasonable, extendable middlewares will born and enrich the whole graphql ecosystem.

Relative issue: #101 #102 #107

コントリビューターガイド