Closed x90slide closed 2 years ago
I think this is just a documentation issue which i've fixed here. https://github.com/gabrielcsapo/node-git-server/pull/103
This should be fixed in 1.0.0 and the exact PR was https://github.com/gabrielcsapo/node-git-server/pull/88 that fixed it. Options was being assumed to exist and the type was not being set by default.
` Git = require('node-git-server').Git join = require('path').join
const port = !process.env.PORT || isNaN(process.env.PORT) ? 7005 : parseInt(process.env.PORT);
const repos = new Git( join(__dirname, '../repo'), { autoCreate: true, } );
repos.on('push', push => { console.log(
push ${push.repo}/${push.commit} ( ${push.branch} )
); push.accept(); });repos.on("fetch", fetch => { console.log(
fetch ${fetch.commit}
); fetch.accept(); });repos.listen(port, () => { console.log(
node-git-server running at http://localhost:${port}
); });`Running this code with 'node index.js' hangs immediately and the server does not start.