mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
feat: Remove overriding tsc compile command #636
This commit is contained in:
parent
c4a8b58379
commit
2a74353c25
4 changed files with 14 additions and 16 deletions
|
@ -4,11 +4,6 @@
|
|||
"description": "Production-ready Node.js GraphQL server for fastify",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"clean": "rm -rf dist",
|
||||
"compile": "tsc",
|
||||
"prepare": "npm run clean && npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-fastify"
|
||||
|
@ -38,7 +33,6 @@
|
|||
"graphql-tools": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graphql": "0.12.7",
|
||||
"apollo-server-integration-testsuite": "file:../apollo-server-integration-testsuite"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -11,15 +11,14 @@ import { graphqlFastify } from './fastifyApollo';
|
|||
|
||||
export { GraphQLOptions, GraphQLExtension } from 'apollo-server-core';
|
||||
import { ApolloServerBase, GraphQLOptions } from 'apollo-server-core';
|
||||
import { IncomingMessage, OutgoingMessage, ServerResponse } from 'http';
|
||||
import { IncomingMessage, OutgoingMessage } from 'http';
|
||||
|
||||
export class ApolloServer extends ApolloServerBase {
|
||||
async createGraphQLServerOptions(
|
||||
request: fastify.FastifyRequest<IncomingMessage>,
|
||||
reply: fastify.FastifyReply<OutgoingMessage>,
|
||||
): Promise<GraphQLOptions> {
|
||||
const options = await super.graphQLServerOptions({ request, reply });
|
||||
return options;
|
||||
return await super.graphQLServerOptions({ request, reply });
|
||||
}
|
||||
|
||||
protected supportsSubscriptions(): boolean {
|
||||
|
@ -42,10 +41,10 @@ export class ApolloServer extends ApolloServerBase {
|
|||
|
||||
await app.addHook(
|
||||
'preHandler',
|
||||
async function(
|
||||
function (
|
||||
this: any,
|
||||
request: any,
|
||||
response: ServerResponse,
|
||||
reply: FastifyReply<OutgoingMessage>,
|
||||
next: any,
|
||||
) {
|
||||
if (request.path !== path) {
|
||||
|
@ -69,10 +68,11 @@ export class ApolloServer extends ApolloServerBase {
|
|||
...this.playgroundOptions,
|
||||
};
|
||||
|
||||
response.setHeader('Content-Type', 'text/html');
|
||||
return response.end(
|
||||
renderPlaygroundPage(playgroundRenderPageOptions),
|
||||
);
|
||||
reply
|
||||
.type('text/html')
|
||||
.send(
|
||||
renderPlaygroundPage(playgroundRenderPageOptions)
|
||||
);
|
||||
}
|
||||
}
|
||||
return next();
|
||||
|
@ -89,7 +89,7 @@ export class ApolloServer extends ApolloServerBase {
|
|||
'PATCH',
|
||||
] as fastify.HTTPMethod[],
|
||||
url: '/.well-known/apollo/server-health',
|
||||
handler: async function(
|
||||
handler: async function (
|
||||
request: any,
|
||||
reply: FastifyReply<OutgoingMessage>,
|
||||
) {
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["**/__tests__", "**/__mocks__"],
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
{ "path": "./packages/apollo-server-core" },
|
||||
{ "path": "./packages/apollo-server-errors" },
|
||||
{ "path": "./packages/apollo-server-express" },
|
||||
{ "path": "./packages/apollo-server-fastify" },
|
||||
{ "path": "./packages/apollo-server-hapi" },
|
||||
{ "path": "./packages/apollo-server-koa" },
|
||||
{ "path": "./packages/apollo-server-lambda" },
|
||||
|
|
Loading…
Add table
Reference in a new issue