27 lines
729 B
JavaScript
27 lines
729 B
JavaScript
const express = require('express');
|
|
const fetch = require('node-fetch');
|
|
|
|
const app = express();
|
|
const port = 3001;
|
|
|
|
app.use(express.static('.'));
|
|
|
|
app.get('/api/commits', async (req, res) => {
|
|
try {
|
|
const response = await fetch('http://143.198.27.163:3000/api/v1/repos/Timmy_Foundation/the-nexus/commits?limit=50', {
|
|
headers: {
|
|
'Authorization': 'token f7bcdaf878d479ad7747873ff6739a9bb89e3f80'
|
|
}
|
|
});
|
|
const data = await response.json();
|
|
res.json(data);
|
|
} catch (error) {
|
|
console.error('Error fetching commits:', error);
|
|
res.status(500).json({ error: 'Failed to fetch commits' });
|
|
}
|
|
});
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Server listening at http://localhost:${port}`);
|
|
});
|