https://github.com/mwguy/git-express
Powerful git middleware for easy building git servers in node
https://github.com/mwguy/git-express
Last synced: 2 months ago
JSON representation
Powerful git middleware for easy building git servers in node
- Host: GitHub
- URL: https://github.com/mwguy/git-express
- Owner: MWGuy
- License: other
- Created: 2020-10-25T17:18:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-25T17:59:57.000Z (over 4 years ago)
- Last Synced: 2024-04-24T00:31:58.462Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-express
Simple library providing middleware for express server to easy build git server
### Install
```bash
$ npm i git-express
```### Example
```typescript
import gitMiddleware, { AuthorizationCredentials, GitMiddlewareAuthorizationMode } from "git-express";const app = express();
const port = 3000;app.use(gitMiddleware({
repositoryResolver: (repositoryPath: string) => {
return {
authorizationMode: GitMiddlewareAuthorizationMode.PUSH_ONLY,
gitRepositoryDirectory: "/path/to/repos/base/" + repositoryPath
}
},
authorize: (repositoryPath: string, credentials: AuthorizationCredentials) => {
return credentials.username === "admin" && credentials.password === "admin";
}
}));app.get('/', (req, res) => {
res.send('Hello World!')
});app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
});```