gabrielcsapo / node-git-server

🎡 A configurable git server written in Node.js
https://gabrielcsapo.github.io/node-git-server
MIT License
253 stars 73 forks source link

have this module do the http server creation internally #2

Closed gabrielcsapo closed 7 years ago

kubenstein commented 7 years ago

After switching to this way of creating a server, i experienced an error (an old way is still working). I debugged and i found the bug and a fix. Should i create a PR?

Git.prototype.listen = function(port, callback) {
    var self = this;   // i had to add this
    http.createServer(function (req, res) {
        self.handle(req, res); // to call handle on self
    }).listen(port, callback);
}

error i got during git push:

/Users/kuba/node_projects/starbucket/node_modules/node-git-server/lib/info.js:10
    dup.cwd = self.dirMap(opts.repo);
                   ^

TypeError: self.dirMap is not a function
    at module.exports (/Users/kuba/node_projects/starbucket/node_modules/node-git-server/lib/info.js:10:20)
    at /Users/kuba/node_projects/starbucket/node_modules/node-git-server/lib/handle.js:47:5
    at next (/Users/kuba/node_projects/starbucket/node_modules/node-git-server/lib/handle.js:16:30)
    at module.exports (/Users/kuba/node_projects/starbucket/node_modules/node-git-server/lib/handle.js:18:7)
    at Server.<anonymous> (/Users/kuba/node_projects/starbucket/node_modules/node-git-server/index.js:87:9)
    at emitTwo (events.js:87:13)
    at Server.emit (events.js:172:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:528:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
gabrielcsapo commented 7 years ago

@kubenstein yes definitely create a PR! Thank you for your investigation!