Skip to content

Commit

Permalink
Step 8.4: Support credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Urigo committed May 20, 2020
1 parent 542a1b3 commit 3e51f38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import schema from './schema';

const app = express();

app.use(cors());
const origin = process.env.ORIGIN || 'http://localhost:3000';
app.use(cors({ credentials: true, origin }));
app.use(express.json());

app.get('/_ping', (req, res) => {
Expand All @@ -26,6 +27,7 @@ const server = new ApolloServer({
server.applyMiddleware({
app,
path: '/graphql',
cors: { credentials: true, origin },
});

const httpServer = http.createServer(app);
Expand Down

0 comments on commit 3e51f38

Please sign in to comment.