Skip to content

Commit 9cce7ae

Browse files
committed
made apollo engine optional
1 parent 335b9fc commit 9cce7ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ const schema = makeExecutableSchema({
2424
resolvers,
2525
});
2626

27-
const engine = new Engine({
28-
engineConfig: { apiKey: process.env.ENGINE_API_KEY },
29-
graphqlPort: constants.PORT,
30-
});
31-
engine.start();
32-
app.use(engine.expressMiddleware());
27+
if (process.env.ENGINE_API_KEY) {
28+
const engine = new Engine({
29+
engineConfig: { apiKey: process.env.ENGINE_API_KEY },
30+
graphqlPort: constants.PORT,
31+
});
32+
engine.start();
33+
app.use(engine.expressMiddleware());
34+
}
3335

3436
app.use(bodyParser.json());
3537

0 commit comments

Comments
 (0)