Enable build support by adding .onedev-buildspec.yml
src | Loading last commit info... | |
.gitignore | ||
README.md | ||
ecosystem.config.js | ||
package.json | ||
tsconfig.json |
README.md
OneDev API Wrapper
This project is a simple Node.js Express server that acts as a wrapper for the OneDev API. It fetches a list of repositories from a OneDev instance, caches them, and exposes them through a simple REST API.
Features
- Fetches a list of repositories from a OneDev instance.
- Caches the repository list to reduce API calls to the OneDev instance.
- Automatically refreshes the cache every 10 minutes.
- Exposes the cached repository list through a
/repos
endpoint. - Sorts the repositories by their last commit date.
Prerequisites
- Node.js
- A OneDev instance
Installation
- Clone the repository:
git clone https://code.weexnes.dev/onedev-api-wrapper
- Install the dependencies:
npm install
- Create a
.env
file in the root of the project and add the following environment variables:ONEDEV_ROOT=<your-onedev-instance-url>
- Start the server:
npm run dev
API
GET /repos
Returns a JSON array of repository objects, sorted by their last commit date.
Example response:
[
{
"name": "my-awesome-project",
"description": "This is an awesome project.",
"timestamp": "2025-07-12T10:00:00.000Z",
"link": "https://onedev.example.com/my-awesome-project"
}
]
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.