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

Adding path to repo #92

Open adhvaithprasad opened 2 years ago

adhvaithprasad commented 2 years ago

You can use it with express like following :

const path = require('path');
const express = require('express');
const app = express();
const Server = require('node-git-server');

const repos = new Server(path.resolve(__dirname, 'tmp'), {
    autoCreate: true
});
const port = process.env.PORT || 7005;

app.use('/git', function(req, res) {
  repos.handle(req, res)
});

app.listen(7005, () => {
  console.log(`Express http server listening`);
});

Is this what you want ?

Originally posted by @esp10mm in https://github.com/gabrielcsapo/node-git-server/issues/58#issuecomment-522491841

I am getting errors like : const u = url_1.default.parse(req?.url || ''); ^

SyntaxError: Unexpected token '.'