Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이승윤
/
OpenSource-MyCookBook
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이승윤
2021-06-06 19:00:39 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b42d7467523c0ca3fccd3a6d969a693b7bc28141
b42d7467
1 parent
a7c7b67f
refector: 코드 리펙토링
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
24 deletions
app.js
routes/auth.js
views/category/productsDetail.ejs
app.js
View file @
b42d746
...
...
@@ -4,16 +4,19 @@ var port = 3000;
var
mongoose
=
require
(
'mongoose'
);
mongoose
.
Promise
=
global
.
Promise
;
//auto-increment를 위한 패키지
var
path
=
require
(
'path'
);
var
logger
=
require
(
'morgan'
);
var
bodyParser
=
require
(
'body-parser'
);
var
cookieParser
=
require
(
'cookie-parser'
);
var
flash
=
require
(
'connect-flash'
);
//passport 로그인 관련
var
passport
=
require
(
'passport'
);
var
session
=
require
(
'express-session'
);
//mongodb 연동
var
db
=
mongoose
.
connection
;
db
.
on
(
'error'
,
console
.
error
);
db
.
once
(
'open'
,
function
()
{
...
...
@@ -39,6 +42,7 @@ app.use(bodyParser.urlencoded({ extended: false }));
app
.
use
(
cookieParser
());
app
.
use
(
'/uploads'
,
express
.
static
(
'uploads'
));
// MiddleWare 지정
var
sessionMiddleWare
=
session
({
secret
:
'fastcampus'
,
resave
:
false
,
...
...
@@ -67,7 +71,7 @@ app.use(function (req, res, next) {
next
();
});
//routes
add
//routes
app
.
use
(
'/'
,
Video
);
app
.
use
(
'/categori'
,
categori
);
app
.
use
(
'/accounts'
,
accounts
);
...
...
routes/auth.js
View file @
b42d746
...
...
@@ -2,7 +2,6 @@ var express = require('express');
var
router
=
express
.
Router
();
var
UserModel
=
require
(
'../models/UserModel'
);
var
passport
=
require
(
'passport'
);
var
FacebookStrategy
=
require
(
'passport-facebook'
).
Strategy
;
const
GoogleStrategy
=
require
(
'passport-google-oauth20'
).
Strategy
;
passport
.
serializeUser
(
function
(
user
,
done
)
{
...
...
@@ -49,10 +48,9 @@ passport.use(
)
);
// http://localhost:3000/auth/facebook 접근시 facebook으로 넘길 url 작성해줌
router
.
get
(
'/google'
,
passport
.
authenticate
(
'google'
,
{
scope
:
[
'profile'
]
}));
//인증후
페이스북
에서 이 주소로 리턴해줌. 상단에 적은 callbackURL과 일치
//인증후
구글
에서 이 주소로 리턴해줌. 상단에 적은 callbackURL과 일치
router
.
get
(
'/google/callback'
,
passport
.
authenticate
(
'google'
,
{
...
...
views/category/productsDetail.ejs
View file @
b42d746
...
...
@@ -107,26 +107,6 @@
</script>
<script>
$(document).on('click' , '.comment_delete' , function(){
if(confirm('삭제하시겠습니까?')){ //확인창 예 눌렀을 시만 진행
var $self = $(this);
$.ajax({
url: '/admin/products/ajax_comment/delete',
type: 'POST',
data: { comment_id : $self.attr('comment_id') },
})
.done(function() {
$self.parent().remove();
alert("삭제가 완료되었습니다.");
})
.fail(function(args) {
console.log(args);
});
}
});
</script>
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
...
...
Please
register
or
login
to post a comment