mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
optimize directory structure
This commit is contained in:
28
lib/routes/github/repos.js
Normal file
28
lib/routes/github/repos.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const user = ctx.params.user;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: `https://api.github.com/users/${user}/repos`,
|
||||
params: {
|
||||
sort: 'created',
|
||||
access_token: config.github.access_token,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
ctx.state.data = {
|
||||
title: `${user}'s GitHub repositories`,
|
||||
link: `https://github.com/${user}`,
|
||||
item:
|
||||
data &&
|
||||
data.map((item) => ({
|
||||
title: item.name,
|
||||
description: item.description || 'No description',
|
||||
pubDate: new Date(item.created_at).toUTCString(),
|
||||
link: item.html_url,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user