@@ -94,25 +94,33 @@ import createSubscriptionsServer from './routes/create-subscription-server';
9494const subscriptionsServer = createSubscriptionsServer ( server , '/websocket' ) ;
9595
9696// Start API wrapped in Apollo Engine
97- // const engine = new ApolloEngine({
98- // logging: {
99- // level: 'WARN',
100- // },
101- // apiKey: process.env.APOLLO_ENGINE_API_KEY,
102- // // Only send perf data to the remote server in production
103- // reporting: {
104- // disabled: process.env.NODE_ENV !== 'production',
105- // hostname: process.env.NOW_URL || undefined,
106- // privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
107- // },
108- // });
109-
110- // engine.listen({
111- // port: PORT,
112- // httpServer: server,
113- // graphqlPaths: ['/api'],
114- // });
115- server . listen ( PORT ) ;
97+ const engine = new ApolloEngine ( {
98+ logging : {
99+ level : 'WARN' ,
100+ } ,
101+ apiKey : process . env . APOLLO_ENGINE_API_KEY ,
102+ // Only send perf data to the remote server in production
103+ reporting : {
104+ disabled : process . env . NODE_ENV !== 'production' ,
105+ hostname : process . env . NOW_URL || undefined ,
106+ privateHeaders : [ 'authorization' , 'Authorization' , 'AUTHORIZATION' ] ,
107+ } ,
108+ queryCache : {
109+ // Don't cache logged-in user responses
110+ privateFullQueryStore : 'disabled' ,
111+ } ,
112+ sessionAuth : {
113+ cookie : 'session' ,
114+ // TODO(@mxstbr): Ping Apollo to note that we need both of those
115+ // header: 'Authorization'
116+ } ,
117+ } ) ;
118+
119+ engine . listen ( {
120+ port : PORT ,
121+ httpServer : server ,
122+ graphqlPaths : [ '/api' ] ,
123+ } ) ;
116124debug ( `GraphQL server running at http://localhost:${ PORT } /api` ) ;
117125
118126process . on ( 'unhandledRejection' , async err => {
0 commit comments