Skip to content

Instantly share code, notes, and snippets.

@EliaECoyote
Created February 24, 2018 15:24
Show Gist options
  • Save EliaECoyote/d6f083be252f942b7c1c5f9f2ad9ea07 to your computer and use it in GitHub Desktop.
Save EliaECoyote/d6f083be252f942b7c1c5f9f2ad9ea07 to your computer and use it in GitHub Desktop.
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);
@asifbd
Copy link

asifbd commented Apr 11, 2019

line 9: "res" probably should be "response"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment