Jieun Chung

add NodeJS

...@@ -11,6 +11,10 @@ EPL 통계 사이트 ...@@ -11,6 +11,10 @@ EPL 통계 사이트
11 11
12 --- 12 ---
13 13
14 +## 설치 방법
15 +1. git clone http://khuhub.khu.ac.kr/2018102163/OSS_PROJECT.git
16 +2. npm install
17 +
14 ## 빌드 방법 18 ## 빌드 방법
15 19
16 20
...@@ -19,4 +23,5 @@ EPL 통계 사이트 ...@@ -19,4 +23,5 @@ EPL 통계 사이트
19 ## 사용 방법 23 ## 사용 방법
20 24
21 25
22 -## LICENSE
...\ No newline at end of file ...\ No newline at end of file
26 +## LICENSE
27 +MIT LICENSE
...\ No newline at end of file ...\ No newline at end of file
......
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "nodejs",
3 + "version": "1.0.0",
4 + "description": "",
5 + "main": "index.js",
6 + "scripts": {
7 + "test": "echo \"Error: no test specified\" && exit 1"
8 + },
9 + "author": "",
10 + "license": "ISC",
11 + "dependencies": {
12 + "express": "^4.17.1",
13 + "request": "^2.88.2"
14 + }
15 +}
1 +const request = require('request');
2 +var express = require('express')
3 +var app = express()
4 +
5 +const options = {
6 + method: 'GET',
7 + url: 'https://api-football-v1.p.rapidapi.com/v2/players/player/253/2018-2019',
8 + headers: {
9 + 'x-rapidapi-key': '9ed13b26e4mshede3aa7b615039ep17f6e6jsn308dd6295276',
10 + 'x-rapidapi-host': 'api-football-v1.p.rapidapi.com',
11 + useQueryString: true
12 + }
13 +};
14 +
15 +app.get('/', function(req, res){
16 + request(options, function (error, response, body) {
17 + if (error) throw new Error(error);
18 +
19 + res.send(body);
20 + console.log(response);
21 + });
22 +
23 +})
24 +
25 +var server = app.listen(23023, function(){
26 + var host = server.address().address
27 + var port = server.address().port;
28 + console.log('App listening at http://%s:%s', host, port)
29 +})