Song

feat: video DB redirecting 수정

...@@ -6,7 +6,7 @@ var Youtube = require('youtube-node'); ...@@ -6,7 +6,7 @@ var Youtube = require('youtube-node');
6 var youtube = new Youtube(); 6 var youtube = new Youtube();
7 7
8 var loginRequired = require('../libs/loginRequired'); 8 var loginRequired = require('../libs/loginRequired');
9 - 9 +var redirectUrls = '';
10 var limit = 10; // 출력 갯수 10 var limit = 10; // 출력 갯수
11 youtube.setKey('AIzaSyCAaeW1qMSInEdN1OzU20FZlToIZYkb1bc'); // API 키 입력 11 youtube.setKey('AIzaSyCAaeW1qMSInEdN1OzU20FZlToIZYkb1bc'); // API 키 입력
12 12
...@@ -26,7 +26,6 @@ router.get('/products', function (req, res) { ...@@ -26,7 +26,6 @@ router.get('/products', function (req, res) {
26 }); 26 });
27 27
28 router.get('/categories/write', loginRequired, function (req, res) { 28 router.get('/categories/write', loginRequired, function (req, res) {
29 - console.log('??');
30 res.render('category/form', { categories: '' }); 29 res.render('category/form', { categories: '' });
31 }); 30 });
32 31
...@@ -51,6 +50,7 @@ router.post('/categories/write', loginRequired, function (req, res) { ...@@ -51,6 +50,7 @@ router.post('/categories/write', loginRequired, function (req, res) {
51 router.get('/products/detail/:id', function (req, res) { 50 router.get('/products/detail/:id', function (req, res) {
52 //url 에서 변수 값을 받아올때 req.params.id 로 받아온다 51 //url 에서 변수 값을 받아올때 req.params.id 로 받아온다
53 var word = req.query.keyword; 52 var word = req.query.keyword;
53 + redirectUrls = req.params.id;
54 CategoriModel.findOne({ _id: req.params.id }, function (err, product) { 54 CategoriModel.findOne({ _id: req.params.id }, function (err, product) {
55 var video = []; 55 var video = [];
56 //제품정보를 받고 그안에서 댓글을 받아온다. 56 //제품정보를 받고 그안에서 댓글을 받아온다.
...@@ -117,7 +117,7 @@ router.get('/products/detail/:id', function (req, res) { ...@@ -117,7 +117,7 @@ router.get('/products/detail/:id', function (req, res) {
117 }); 117 });
118 }); 118 });
119 } else { 119 } else {
120 - console.log(mitem); 120 + //console.log(mitem);
121 res.render('category/productsDetail', { 121 res.render('category/productsDetail', {
122 product: product, 122 product: product,
123 comments: comments, 123 comments: comments,
...@@ -201,7 +201,7 @@ router.get('/products/delete/:id', function (req, res) { ...@@ -201,7 +201,7 @@ router.get('/products/delete/:id', function (req, res) {
201 router.get('/products/detail/delete/:id', function (req, res) { 201 router.get('/products/detail/delete/:id', function (req, res) {
202 VideoModel.findOne({ _id: req.params.id }, function (err, products) { 202 VideoModel.findOne({ _id: req.params.id }, function (err, products) {
203 VideoModel.deleteMany({ _id: products }, function (err) { 203 VideoModel.deleteMany({ _id: products }, function (err) {
204 - res.redirect('/categori/products/'); 204 + res.redirect('/categori/products/detail/'+ redirectUrls);
205 }); 205 });
206 }); 206 });
207 }); 207 });
......