add discord api test call

This commit is contained in:
2021-07-31 15:11:33 +02:00
parent a0b83f7ed9
commit de3cf665c3
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import axios from 'axios';
exports.handler = async function(event, context) {
axios
.get(`https://discord.com/api/v9/users/@me`, {
headers: {
Authorization: `Bot ${process.env.token}`,
},
})
.then((response) => {
return {
statusCode: 200,
body: response.data,
};
})
.catch((error) => {
return {
statusCode: 500,
body: JSON.stringify('discord api shat itself brb'),
};
});
};

13
package-lock.json generated
View File

@@ -1937,6 +1937,14 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"babel-loader": {
"version": "8.0.5",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.5.tgz",
@@ -4912,6 +4920,11 @@
"readable-stream": "^2.3.6"
}
},
"follow-redirects": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg=="
},
"for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",

View File

@@ -7,6 +7,7 @@
"build": "gridsome build"
},
"dependencies": {
"axios": "^0.21.1",
"gridsome": "^0.7.0",
"sass": "^1.37.0",
"sass-loader": "^10.1.1"