Created
February 24, 2018 15:24
-
-
Save EliaECoyote/d6f083be252f942b7c1c5f9f2ad9ea07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as functions from 'firebase-functions'; | |
import * as express from 'express'; | |
const app = express(); | |
app.get('/events/:id', (request, response) => { | |
const userAgent = request.get('user-agent'); | |
if (userAgent.indexOf("facebookexternalhit") === 0) { | |
res.status(200).send(` | |
<!doctype html> | |
<head><title>Facebook</title></head> | |
</html> | |
`); | |
} | |
}); | |
exports.eventsReqHandler = functions.https.onRequest(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 9: "res" probably should be "response"?