Created
August 16, 2012 16:32
-
-
Save mbostock/3371488 to your computer and use it in GitHub Desktop.
Git-backed Node Blob Server
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
var express = require("express"), | |
gitteh = require("gitteh"), | |
path = require("path"); | |
var server = express(); | |
server.get("/", function(request, response) { | |
gitteh.openRepository(path.join(__dirname, "repository", ".git"), function(error, repository) { | |
if (error) return response.end(error.toString()); | |
repository.getBlob("9b4b40c2bca67e781930105fa190b9b90235cfe5", function(error, blob) { | |
if (error) return response.end(error.toString()); | |
response.end(blob.data.toString("UTF-8")); | |
}); | |
}); | |
}); | |
server.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved to git-static.