Skip to content

Instantly share code, notes, and snippets.

@csusbdt
Last active December 10, 2015 00:28
Show Gist options
  • Save csusbdt/4351124 to your computer and use it in GitHub Desktop.
Save csusbdt/4351124 to your computer and use it in GitHub Desktop.
Node express request handler that returns Facebook channel.html with one-year expiration.
// Return Facebook channel.html with one-year expiration.
app.get('/channel.html', function(req, res) {
var channelDoc = '<script src="//connect.facebook.net/en_US/all.js"></script>';
res.set({
'Content-Type': 'text/html',
'Content-Length': channelDoc.length,
'Pragma': 'public',
'Cache-Control': 'max-age=31536000',
'Expires': new Date(Date.now() + 31536000000).toUTCString()
});
res.end(channelDoc);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment