forgejo-js
v11.0.0
Published
[](https://www.npmjs.com/package/forgejo-js) [](https://www.npmjs.com/package/forgejo-js/) [ to make requests. For node you can use cross-fetch to polyfill the Fetch Api.
For Gitea you can use gitea-js.
Version mapping
The major and minor version of this library is mapped to the version of the Forgejo api. The patch version of this library is incremented for every release and uses the latest patch version of Forgejo.
| Forgejo-js | Forgejo | | ---------- | ------- | | 11.0.x | 11.0 | | 9.0.x | 9.0 |
Examples
Browser
import { forgejoApi } from 'forgejo-js';
const api = forgejoApi('https://codeberg.org/', {
token: 'access-token', // generate one at https://forgejo.example.com/user/settings/applications
});
const repo = api.repos.repoGet('anbraten', 'forgejo-js');
console.log(repo);Node.js
const { forgejoApi } = require('forgejo-js');
const fetch = require('cross-fetch'); // You have to use a fetch compatible polyfill like cross-fetch for older Node.JS versions
const api = forgejoApi('https://codeberg.org/', {
token: 'access-token', // generate one at https://forgejo.example.com/user/settings/applications
customFetch: fetch,
});
const repo = api.repos.repoGet('anbraten', 'forgejo-js');
console.log(repo);