Skip to content

Instantly share code, notes, and snippets.

@harrylincoln
Created July 13, 2017 16:46
Show Gist options
  • Save harrylincoln/4134690a4888b622b7da8526a19f39f7 to your computer and use it in GitHub Desktop.
Save harrylincoln/4134690a4888b622b7da8526a19f39f7 to your computer and use it in GitHub Desktop.
/api routes and the authentication handled by the brilliant express-firebase-middleware
...
router.use('/api', cors(), firebaseMiddleware.auth);
router.get('/api/hello', (req, res) => {
res.json({
message: `You're logged in as ${res.locals.user.email} with Firebase UID: ${res.locals.user.uid}`
});
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment