mirror of
https://github.com/vale981/apollo-server
synced 2025-03-17 00:06:42 -04:00

* Setup prettier and precommit hooks * Format code with prettier * Use husky because it works... * Move prettier config to .prettierrc file * Implement fixing markdown file formatting when running lint-fix script * Format markdown files * Add .json file formatting * Fixes json file formatting * Add pretteir linting step * Remove tslint * Use gitignore for prettier * Fix linting errors * Ignore submodule folder
28 lines
820 B
TypeScript
28 lines
820 B
TypeScript
import * as connect from 'connect';
|
|
import * as bodyParser from 'body-parser';
|
|
import { graphqlConnect, graphiqlConnect } from './connectApollo';
|
|
import 'mocha';
|
|
|
|
import testSuite, {
|
|
schema as Schema,
|
|
CreateAppOptions,
|
|
} from 'apollo-server-integration-testsuite';
|
|
|
|
function createConnectApp(options: CreateAppOptions = {}) {
|
|
const app = connect();
|
|
|
|
options.graphqlOptions = options.graphqlOptions || { schema: Schema };
|
|
if (!options.excludeParser) {
|
|
app.use('/graphql', bodyParser.json());
|
|
}
|
|
if (options.graphiqlOptions) {
|
|
app.use('/graphiql', graphiqlConnect(options.graphiqlOptions));
|
|
}
|
|
app.use('/graphql', require('connect-query')());
|
|
app.use('/graphql', graphqlConnect(options.graphqlOptions));
|
|
return app;
|
|
}
|
|
|
|
describe('integration:Connect', () => {
|
|
testSuite(createConnectApp);
|
|
});
|