김명주

Move image file

Showing 1000 changed files with 37 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +var key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiMjAxNjMxMTYzIiwiYXV0aF9pZCI6IjIiLCJ0b2tlbl90eXBlIjoiQWNjZXNzVG9rZW4iLCJzZXJ2aWNlX2lkIjoiNDMwMDExMzkzIiwiWC1BcHAtUmF0ZS1MaW1pdCI6IjUwMDoxMCIsIm5iZiI6MTYzNDMwMTE0NCwiZXhwIjoxNjQ5ODUzMTQ0LCJpYXQiOjE2MzQzMDExNDR9.EEWMly4HZG_DY-aleMtDFVOOmbWl8uVmG1tHVM3c-BE"
2 +var chname;
3 +
4 +exports.home_get=function(req,res){
5 + res.render('search_home');
6 +};
7 +
8 +
9 +exports.result_post=function(req,res){
10 + chname=encodeURIComponent(req.body.test);
11 +};
12 +
13 +exports.result_get=function(req,res){
14 + var api_url='https://api.nexon.co.kr/kart/v1.0/users/nickname/'+chname;
15 + var request=require('request');
16 + var options={
17 + url: api_url,
18 + headers:{Authorization: key}
19 + };
20 + request.get(options, function(error, response, body){
21 + if (!error && response.statusCode == 200) {
22 + var jsbody=JSON.parse(body);
23 + var option2={
24 + //개인전만 검색하는 것임
25 + url: "https://api.nexon.co.kr/kart/v1.0/users/"+jsbody.accessId+"/matches?start_date=&end_date= &offset=0&limit=10&match_types=7b9f0fd5377c38514dbb78ebe63ac6c3b81009d5a31dd569d1cff8f005aa881a",
26 + headers:{Authorization: key}
27 + };
28 + request.get(option2, function(error, response, body){
29 + var match=JSON.parse(body);
30 + res.render('search_result',{name: jsbody.name, level: jsbody.level,body:JSON.stringify(match)});
31 + });
32 + } else {
33 + res.status(response.statusCode).end();
34 + console.log('error = ' + response.statusCode);
35 + }
36 + });
37 +};
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.