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

Ability to create our own endpoints?

Open Slydelix opened this issue 6 years ago • 5 comments

Is it possible to create our own endpoints? If yes, how and if not, could you implement something like this?

Slydelix avatar Jul 31 '19 10:07 Slydelix

What would your custom endpoints do?

plunkettscott avatar Aug 02 '19 18:08 plunkettscott

List all repos, show info about repos, literally anything

Slydelix avatar Aug 10 '19 23:08 Slydelix

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 ?

esp10mm avatar Aug 19 '19 09:08 esp10mm

This is what groffee was supposed to be, https://github.com/gabrielcsapo/groffee. This library was meant as a backing library to build a GitHub like application.

On Mon, Aug 19, 2019 at 2:34 AM esp10mm [email protected] wrote:

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 ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gabrielcsapo/node-git-server/issues/58?email_source=notifications&email_token=AAOE2W4Y2KMFYRP67MTFJRTQFJSLDA5CNFSM4IIFCT32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4SJPQI#issuecomment-522491841, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOE2WYVCSDN7G3N2BVA5QLQFJSLDANCNFSM4IIFCT3Q .

gabrielcsapo avatar Aug 19 '19 14:08 gabrielcsapo

@esp10mm yes but i want to able to do that with the http server the git server is already running on... EDIT: Actually no, I want to be able to add my own functions and stuff to the existing server, not redirect stuff to it

@gabrielcsapo since that lib isn't going switching to express may work... We could to server.express.get("/customroute", (req, res) => {});

Slydelix avatar Aug 19 '19 21:08 Slydelix