simpler local request paths, remove logging
This commit is contained in:
@@ -141,19 +141,14 @@ export default async (_, res) => {
|
||||
res.setHeader("Content-Type", "application/json");
|
||||
try {
|
||||
// Add header to prevent abuse.
|
||||
try {
|
||||
const PATsInfo = await getPATInfo(uptimeFetcher, {});
|
||||
if (PATsInfo) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=0, s-maxage=${RATE_LIMIT_SECONDS}`,
|
||||
);
|
||||
}
|
||||
res.send(JSON.stringify(PATsInfo, null, 2));
|
||||
console.log("pat-info done");
|
||||
} catch (e) {
|
||||
console.log("pat-info exception:", e);
|
||||
const PATsInfo = await getPATInfo(uptimeFetcher, {});
|
||||
if (PATsInfo) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=0, s-maxage=${RATE_LIMIT_SECONDS}`,
|
||||
);
|
||||
}
|
||||
res.send(JSON.stringify(PATsInfo, null, 2));
|
||||
} catch (err) {
|
||||
// Throw error if something went wrong.
|
||||
logger.error(err);
|
||||
|
||||
@@ -248,20 +248,12 @@ const buildSearchFilter = (repos = [], owners = []) => {
|
||||
* @returns {Promise<any>} Request response.
|
||||
*/
|
||||
const request = (data, headers) => {
|
||||
console.log("making request with: " + JSON.stringify(headers) + " | " + JSON.stringify(data));
|
||||
try {
|
||||
let response = axios({
|
||||
url: "https://api.github.com/graphql",
|
||||
method: "post",
|
||||
headers,
|
||||
data,
|
||||
});
|
||||
console.log("response: ", response);
|
||||
return response;
|
||||
} catch (e) {
|
||||
console.log("request exception:", e);
|
||||
return null;
|
||||
}
|
||||
return axios({
|
||||
url: "https://api.github.com/graphql",
|
||||
method: "post",
|
||||
headers,
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -155,12 +155,12 @@ const HomeScreen = () => {
|
||||
await testEndpoint('/api?username=martin-mfg');
|
||||
await testEndpoint('/api/gist?id=bbfce31e0217a3689c8d961a356cb10d');
|
||||
await testEndpoint(
|
||||
'/api/pin/?username=martin-mfg&repo=openapi-generator',
|
||||
'/api/pin?username=martin-mfg&repo=openapi-generator',
|
||||
);
|
||||
await testEndpoint(
|
||||
'/api/top-langs/?username=anuraghazra&langs_count=4',
|
||||
'/api/top-langs?username=anuraghazra&langs_count=4',
|
||||
);
|
||||
await testEndpoint('/api/wakatime/?username=ffflabs');
|
||||
await testEndpoint('/api/wakatime?username=ffflabs');
|
||||
console.log('PAT_1: ', process.env.PAT_1);
|
||||
// console.log(router);
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user