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

Ability to create our own endpoints? #58

Open Slydelix opened 5 years ago

Slydelix commented 5 years ago

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

plunkettscott commented 5 years ago

What would your custom endpoints do?

Slydelix commented 5 years ago

List all repos, show info about repos, literally anything

esp10mm commented 5 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 ?

gabrielcsapo commented 5 years ago

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 notifications@github.com 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 .

Slydelix commented 5 years ago

@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) => {});