node-git-server icon indicating copy to clipboard operation
node-git-server copied to clipboard

Added the option to specify a host

Open h110m opened this issue 3 years ago • 1 comments
trafficstars

Ref: #100

h110m avatar Aug 16 '22 09:08 h110m

For now this PR is not merge yet, so an alternative is doing that (at least until this PR merged);

// import http server
const http = require('http');

//... all other configs
const repos = new Git(join(__dirname, '../repo'), {
  autoCreate: true,
});
//... all other configs

// replace this
// repos.listen(port, "0.0.0.0", () => {
//   console.log(`node-git-server running at http://localhost:${port}`);
// });

// with this
repos.server = http.createServer((req, res) => {
  repos.handle(req, res);
});

repos.server.listen(port, "0.0.0.0", () => {
  console.log(`node-git-server running at http://localhost:${port}`);
});

agutoli avatar Sep 08 '22 05:09 agutoli