Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 19 additions & 27 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,25 @@ import createSubscriptionsServer from './routes/create-subscription-server';
const subscriptionsServer = createSubscriptionsServer(server, '/websocket');

// Start API wrapped in Apollo Engine
const engine = new ApolloEngine({
logging: {
level: 'WARN',
},
apiKey: process.env.APOLLO_ENGINE_API_KEY,
// Only send perf data to the remote server in production
reporting: {
disabled: process.env.NODE_ENV !== 'production',
hostname: process.env.NOW_URL || undefined,
privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
},
queryCache: {
// Don't cache logged-in user responses
privateFullQueryStore: 'disabled',
},
sessionAuth: {
cookie: 'session',
// TODO(@mxstbr): Ping Apollo to note that we need both of those
// header: 'Authorization'
},
});

engine.listen({
port: PORT,
httpServer: server,
graphqlPaths: ['/api'],
});
// const engine = new ApolloEngine({
// logging: {
// level: 'WARN',
// },
// apiKey: process.env.APOLLO_ENGINE_API_KEY,
// // Only send perf data to the remote server in production
// reporting: {
// disabled: process.env.NODE_ENV !== 'production',
// hostname: process.env.NOW_URL || undefined,
// privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
// },
// });

// engine.listen({
// port: PORT,
// httpServer: server,
// graphqlPaths: ['/api'],
// });
server.listen(PORT);
debug(`GraphQL server running at http://localhost:${PORT}/api`);

process.on('unhandledRejection', async err => {
Expand Down
3 changes: 0 additions & 3 deletions api/routes/api/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export default graphqlExpress(req => {
return {
schema,
formatError: createErrorFormatter(req),
tracing: true,
cacheControl: true,
engine: false,
context: {
loaders,
user: currentUser,
Expand Down
2 changes: 1 addition & 1 deletion api/types/Community.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Community = /* GraphQL */ `
node: Thread!
}

type CommunityMetaData @cacheControl(maxAge: 1800) {
type CommunityMetaData {
members: Int
channels: Int
onlineMembers: Int
Expand Down