Akhidjon

Setting up routes

...@@ -47,6 +47,7 @@ var mytoons = require('./routes/mytoons'); ...@@ -47,6 +47,7 @@ var mytoons = require('./routes/mytoons');
47 var yourtoons =require('./routes/yourtoons'); 47 var yourtoons =require('./routes/yourtoons');
48 var setting = require('./routes/setting'); 48 var setting = require('./routes/setting');
49 49
50 +
50 // 최초 로그인 성공시 (Strategy 성공시) 단 한번만 호출 51 // 최초 로그인 성공시 (Strategy 성공시) 단 한번만 호출
51 passport.serializeUser(function(user, done) { 52 passport.serializeUser(function(user, done) {
52 console.log('serialized'); 53 console.log('serialized');
...@@ -97,6 +98,7 @@ app.use('/users', users); ...@@ -97,6 +98,7 @@ app.use('/users', users);
97 app.use('/mytoons', mytoons); 98 app.use('/mytoons', mytoons);
98 app.use('/setting', setting); 99 app.use('/setting', setting);
99 app.use('/yourtoons', yourtoons); 100 app.use('/yourtoons', yourtoons);
101 +app.use('/login', require('./routes/login')) // added new login page
100 102
101 // catch 404 and forward to error handler, for wrong page 103 // catch 404 and forward to error handler, for wrong page
102 app.use(function(req, res, next) { 104 app.use(function(req, res, next) {
......
...@@ -125,6 +125,11 @@ function loginByThirdparty(info, done) { ...@@ -125,6 +125,11 @@ function loginByThirdparty(info, done) {
125 }); 125 });
126 } 126 }
127 127
128 +router.get('/login', function(req,res){
129 + res.render('login_page')
130 +})
131 +
132 +
128 // 라우터 설정, 카카오 133 // 라우터 설정, 카카오
129 router.get('/auth/logout/kakao',function (req,res) { 134 router.get('/auth/logout/kakao',function (req,res) {
130 req.logout(); 135 req.logout();
......
1 +var express = require('express');
2 +var cheerio = require('cheerio');
3 +var request = require('request');
4 +var mysql = require('mysql');
5 +var client = require('cheerio-httpcli');
6 +var passport = require('passport');
7 +var KakaoStrategy = require('passport-kakao').Strategy;
8 +var NaverStrategy = require('passport-naver').Strategy;
9 +var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
10 +var router = express.Router();
11 +
12 +
13 +router.get('/login', (req,res)=> res.render('login_page'));
14 +
15 +module.exports = router;
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
47 <ul class="nav navbar-nav navbar-right"> 47 <ul class="nav navbar-nav navbar-right">
48 <li><a href="#about" class="page-scroll">About</a></li> 48 <li><a href="#about" class="page-scroll">About</a></li>
49 <li><a href="#portfolio" class="page-scroll">Webtoons</a></li> 49 <li><a href="#portfolio" class="page-scroll">Webtoons</a></li>
50 - <li><a href="/auth/login/kakao" class="page-scroll">kakaoLogin</a></li> 50 + <li><a href="/login" class="page-scroll">Login</a></li>
51 - <li><a href="/auth/login/naver" class="page-scroll">naverLogin</a></li>
52 - <li><a href="/auth/login/google" class="page-scroll">googleLogin</a></li>
53 </ul> 51 </ul>
54 </div> 52 </div>
55 <!-- /.navbar-collapse --> 53 <!-- /.navbar-collapse -->
......