Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to create our own endpoints? #58

Open
Slydelix opened this issue Jul 31, 2019 · 5 comments
Open

Ability to create our own endpoints? #58

Slydelix opened this issue Jul 31, 2019 · 5 comments

Comments

@Slydelix
Copy link

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

@plunkettscott
Copy link

What would your custom endpoints do?

@Slydelix
Copy link
Author

List all repos, show info about repos, literally anything

@esp10mm
Copy link

esp10mm commented Aug 19, 2019

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
Copy link
Owner

gabrielcsapo commented Aug 19, 2019 via email

@Slydelix
Copy link
Author

Slydelix commented Aug 19, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants