diff --git a/express-graphql/express-graphql-tests.ts b/express-graphql/express-graphql-tests.ts
index ec9e48ea43..7469a0801d 100644
--- a/express-graphql/express-graphql-tests.ts
+++ b/express-graphql/express-graphql-tests.ts
@@ -1,10 +1,29 @@
///
///
+///
-var express = require("express");
-var graphqlHTTP = require("express-graphql");
-var app = express();
+import * as express from "express";
+import * as graphqlHTTP from "express-graphql";
-var schema = {};
+const app = express();
+const schema = {};
-app.use("/graphql", graphqlHTTP({ schema: schema, graphiql: true }));
+const graphqlOption: graphqlHTTP.OptionsObj = {
+ graphiql: true,
+ schema: schema,
+ formatError: (error:Error) => ({
+ message: error.message,
+ })
+};
+
+const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsObj => ({
+ graphiql: true,
+ schema: schema,
+ context: request.session,
+});
+
+app.use("/graphql1", graphqlHTTP(graphqlOption));
+
+app.use("/graphql2", graphqlHTTP(graphqlOptionRequest));
+
+app.listen(8080);
diff --git a/express-graphql/express-graphql.d.ts b/express-graphql/express-graphql.d.ts
index ecaa2dc43a..e5f42f5839 100644
--- a/express-graphql/express-graphql.d.ts
+++ b/express-graphql/express-graphql.d.ts
@@ -20,6 +20,11 @@ declare module "express-graphql" {
*/
schema:Object,
+ /**
+ * A value to pass as the context to the graphql() function.
+ */
+ context?:Object,
+
/**
* An object to pass as the rootValue to the graphql() function.
*/