public
Created

  • Download Gist
static file in node.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13
fs.readFile(this.files[uri], "binary", function(err, content) {
if (err) {
res.sendHeader(404, {
});
} else {
res.sendHeader(200, {
"Content-Type": mime_type,
"Cache-Control": "public, max-age=300"
});
res.write(content, "binary");
}
res.end();
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.