kimkyeonghun

API 키 query and 링크

1 +{"API":"AIzaSyCTR9nHa9PheDMJO9O91Oj8HRJcu81bP_M"}
...\ No newline at end of file ...\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 5
6 // 모듈 가져오기 6 // 모듈 가져오기
7 var express = require('express') 7 var express = require('express')
8 - , routes = require('./routes') 8 + , main = require('./routes/index')
9 , todo = require('./routes/todo') 9 , todo = require('./routes/todo')
10 , login =require('./routes/login') 10 , login =require('./routes/login')
11 , http = require('http') 11 , http = require('http')
...@@ -37,9 +37,9 @@ app.configure('development', function(){ // 개발 버전 ...@@ -37,9 +37,9 @@ app.configure('development', function(){ // 개발 버전
37 }); 37 });
38 38
39 // 라우팅 39 // 라우팅
40 -app.get('/', routes.index); 40 +app.get('/Vlist', main.index);
41 -app.get('/login',function(req,res){ 41 +app.get('/',function(req,res){
42 - fs.readFile('./views/login.html',function(error,data){ 42 + fs.readFile('./views/login.html/',function(error,data){
43 res.writeHead(200, {'Content-Type': 'text/html'}); 43 res.writeHead(200, {'Content-Type': 'text/html'});
44 res.end(data); 44 res.end(data);
45 }) 45 })
......
1 +
1 $(document).ready(function(){ 2 $(document).ready(function(){
2 3
3 // 로그인 처리 4 // 로그인 처리
...@@ -27,7 +28,8 @@ $(document).ready(function(){ ...@@ -27,7 +28,8 @@ $(document).ready(function(){
27 for (var i=0, len=list.length; i < len; i++){ 28 for (var i=0, len=list.length; i < len; i++){
28 if (list[i].userId==Info['userId']){ 29 if (list[i].userId==Info['userId']){
29 if (list[i].password==Info['password']){ 30 if (list[i].password==Info['password']){
30 - location.href='/'; 31 + location.href='/Vlist?API='+list[i].API;
32 + return;
31 } 33 }
32 } 34 }
33 } 35 }
......
...@@ -2,7 +2,14 @@ ...@@ -2,7 +2,14 @@
2 /* 2 /*
3 * GET home page. 3 * GET home page.
4 */ 4 */
5 +var fs=require("fs");
5 6
6 exports.index = function(req, res){ 7 exports.index = function(req, res){
8 + var data={
9 + 'API' : req.query.API
10 + }
11 + fs.writeFile('./API_Key.json', JSON.stringify(data), function (err) { // todo_list.json 파일 쓰기
12 + res.json(data);
13 + });
7 res.render('index', { title: '나만의 YOUTUBE 리스트' }); 14 res.render('index', { title: '나만의 YOUTUBE 리스트' });
8 }; 15 };
......
...@@ -7,7 +7,6 @@ exports.LogInForm=function(req,res){ ...@@ -7,7 +7,6 @@ exports.LogInForm=function(req,res){
7 fs.readFile('./user_list.json', { 7 fs.readFile('./user_list.json', {
8 'encoding': 'utf8' 8 'encoding': 'utf8'
9 }, function (err, list) { 9 }, function (err, list) {
10 - console.log(list);
11 res.json(list); 10 res.json(list);
12 }); 11 });
13 } else { 12 } else {
......
...@@ -33,11 +33,12 @@ exports.add = function(req, res1){ // 새로운 ToDo 항목 추가하기 ...@@ -33,11 +33,12 @@ exports.add = function(req, res1){ // 새로운 ToDo 항목 추가하기
33 33
34 //유튜브 api 이용 검색부분 34 //유튜브 api 이용 검색부분
35 35
36 - console.log(req.body); 36 + var datas=fs.readFileSync('./API_Key.json',{'encoding':'utf8'});
37 + datas=JSON.parse(datas);
37 var optionParams = { 38 var optionParams = {
38 q:req.body.contents, 39 q:req.body.contents,
39 part:"snippet", 40 part:"snippet",
40 - key:"AIzaSyCTR9nHa9PheDMJO9O91Oj8HRJcu81bP_M", 41 + key: datas.API,
41 type:"video", 42 type:"video",
42 maxResults: Number(req.body.counts), 43 maxResults: Number(req.body.counts),
43 regionCode:"KR", 44 regionCode:"KR",
......
1 -{"list":[{"contents":"구자철·기성용 &quot;남태희, 백성동 빨리 안나와?&quot;","videoId":"JFedpGFFjkM","complete":false}]}
...\ No newline at end of file ...\ No newline at end of file
1 +{"list":[{"contents":"[하나금융그룹x손흥민 광고] &quot;함께가 힘이다. 하나가 힘이다(Full Ver)&quot; 편","videoId":"HlYWi_AdVYc","complete":false},{"contents":"손흥민 잉글랜드무대 첫 해트트릭,,,!!! 평점 10점받은 경기 ● 토트넘 vs 밀월 ● 하이라이트","videoId":"wbv5bUErdX0","complete":false},{"contents":"구자철 세계최초 두부 트래핑 도전 l 슛포러브 Shoot for Love","videoId":"1z9rGJue4pQ","complete":false},{"contents":"고려청자를 트래핑 할수 있을까요?? 구자철 선수가 직접 도전에 나서보았습니다 l 슛포러브 Shoot for Love","videoId":"Fbn85Ghgclg","complete":false},{"contents":"우리가 원했던 경기력 !!! 손흥민 멀티골, 기성용 탈압박 ● 대한민국 vs 콜롬비아 ● 하이라이트","videoId":"9dQ02l7YlQI","complete":false},{"contents":"기성용의 후배털기 ( 손흥민, 이승우, 정우영, 황희찬, 황의조)","videoId":"lHIZJ58UQow","complete":false}]}
...\ No newline at end of file ...\ No newline at end of file
......
1 -{"list":[{"fname":"김경훈","userId":"kkh115505@naver.com","API":"abcdefg","password":"1234"}]}
...\ No newline at end of file ...\ No newline at end of file
1 +{"list":[{"fname":"김경훈","userId":"kkh115505@naver.com","API":"AIzaSyCTR9nHa9PheDMJO9O91Oj8HRJcu81bP_M","password":"1234"}]}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
7 </head> 7 </head>
8 <body> 8 <body>
9 <h1><%= title %></h1> 9 <h1><%= title %></h1>
10 - <p>Welcome to <%= title %></p>
11 <form class="form-inline"> <!-- 새로운 ToDo 항목 추가 --> 10 <form class="form-inline"> <!-- 새로운 ToDo 항목 추가 -->
12 <div class="form-group"> 11 <div class="form-group">
13 <input type="text" class="form-control" id="new_todo" placeholder="유튜브명"> 12 <input type="text" class="form-control" id="new_todo" placeholder="유튜브명">
......
...@@ -24,18 +24,18 @@ ...@@ -24,18 +24,18 @@
24 <div class="row justify-content-center"> 24 <div class="row justify-content-center">
25 <div class="col-md-8"> 25 <div class="col-md-8">
26 <div class="card"> 26 <div class="card">
27 - <div class="card-header">Login</div> 27 + <div class="card-header">로그인</div>
28 <div class="card-body"> 28 <div class="card-body">
29 <form action="" method=""> 29 <form action="" method="">
30 <div class="form-group row"> 30 <div class="form-group row">
31 - <label for="userid" class="col-md-4 col-form-label text-md-right">E-Mail Address</label> 31 + <label for="userid" class="col-md-4 col-form-label text-md-right">아이디(이메일)</label>
32 <div class="col-md-6"> 32 <div class="col-md-6">
33 <input type="text" id="userid" class="form-control" name="userid" required autofocus> 33 <input type="text" id="userid" class="form-control" name="userid" required autofocus>
34 </div> 34 </div>
35 </div> 35 </div>
36 36
37 <div class="form-group row"> 37 <div class="form-group row">
38 - <label for="password" class="col-md-4 col-form-label text-md-right">Password</label> 38 + <label for="password" class="col-md-4 col-form-label text-md-right">패스워드</label>
39 <div class="col-md-6"> 39 <div class="col-md-6">
40 <input type="password" id="password" class="form-control" name="password" required> 40 <input type="password" id="password" class="form-control" name="password" required>
41 </div> 41 </div>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
44 <button type="submit" id="login-submit" class="btn btn-primary"> 44 <button type="submit" id="login-submit" class="btn btn-primary">
45 로그인 45 로그인
46 </button> 46 </button>
47 - <button type="button" id="makeInfo" class="btn btn-primary"> 47 + <button type="button" id="makeInfo" class="btn btn-success">
48 회원가입하기 48 회원가입하기
49 </button> 49 </button>
50 </a> 50 </a>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
36 <label class="col-md-4 control-label" for="ssnein">YouTube Api Key</label> 36 <label class="col-md-4 control-label" for="ssnein">YouTube Api Key</label>
37 <div class="col-md-5"> 37 <div class="col-md-5">
38 <input id="ssnein" name="ssnein" type="text" placeholder="YouTube Api Key" class="form-control input-md" required=""> 38 <input id="ssnein" name="ssnein" type="text" placeholder="YouTube Api Key" class="form-control input-md" required="">
39 - <span class="help-block">링크 걸어줍시다.</span> 39 + <span class="help-block"><a href="https://console.developers.google.com/start">API키 발급받기</a></span>
40 </div> 40 </div>
41 </div> 41 </div>
42 <!-- Text input--> 42 <!-- Text input-->
......