Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이재용
/
TFT_My_Galaxy
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이재용
2020-06-28 17:25:47 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e9babf754bb9d7ee7df65fcfc0416e20538877f4
e9babf75
1 parent
380c63b6
api 분리로 가독성 향상, 동기화 사용
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
TFT_My_Galaxy/api/api.js
TFT_My_Galaxy/api/api.js
0 → 100644
View file @
e9babf7
var
request
=
require
(
'request'
);
var
search
=
{};
var
apikey
=
"RGAPI-4ccc267c-4dba-46f4-b705-bdb224f15ac2"
//사용자 정보 api
search
.
getPuuid
=
function
(
name
){
return
new
Promise
(
function
(
resolve
,
reject
){
request
({
url
:
"https://kr.api.riotgames.com/lol/summoner/v4/summoners/by-name/"
+
name
+
"?api_key="
+
apikey
,
method
:
'GET'
},
function
(
err
,
res
,
body
){
resolve
(
JSON
.
parse
(
body
).
puuid
);
});
});
};
//ppuid를 이용한 게임링크 api
search
.
getGamename
=
function
(
puuid
){
return
new
Promise
(
function
(
resolve
,
reject
){
request
({
uri
:
"https://asia.api.riotgames.com/tft/match/v1/matches/by-puuid/"
+
puuid
+
"/ids?count=20&api_key="
+
apikey
,
method
:
'GET'
},
function
(
err
,
res
,
body
){
// console.log(JSON.parse(body).link);
resolve
(
JSON
.
parse
(
body
));
});
});
};
search
.
getGametrait
=
function
(
game_id
){
return
new
Promise
(
function
(
resolve
,
reject
){
request
({
url
:
"https://asia.api.riotgames.com/tft/match/v1/matches/"
+
game_id
+
"?api_key="
+
apikey
,
method
:
'GET'
},
function
(
err
,
res
,
body
){
// console.log(JSON.parse(body).link);
resolve
(
JSON
.
parse
(
body
).
info
);
});
});
};
module
.
exports
=
search
;
\ No newline at end of file
Please
register
or
login
to post a comment