optimize directory structure

This commit is contained in:
DIYgod
2018-12-26 18:35:10 +08:00
parent c68251e461
commit 38a90e29b0
475 changed files with 52 additions and 52 deletions

View File

@@ -0,0 +1,45 @@
const axios = require('../../utils/axios');
const config = require('../../config');
module.exports = async (ctx) => {
const user = ctx.params.user;
const host = `https://github.com/${user}`;
const url = 'https://api.github.com/graphql';
const response = await axios({
method: 'post',
url,
headers: {
Authorization: `bearer ${config.github.access_token}`,
},
data: {
query: `
{
user(login: "${user}") {
followers(first: 10) {
edges {
node {
login
avatarUrl
}
}
}
}
}
`,
},
});
const data = response.data.data.user.followers.edges;
ctx.state.data = {
title: `${user}'s followers`,
link: host,
item: data.map((follower) => ({
title: `${follower.node.login} started following ${user}`,
description: `<a href="https://github.com/${follower.node.login}">${follower.node.login}</a> <br> <img sytle="width:50px;" src='${follower.node.avatarUrl}'>`,
link: `https://github.com/${follower.node.login}`,
})),
};
};