Toggle navigation
Toggle navigation
This project
Loading...
Sign in
MotherProject
/
myYoutube
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
Flare-k
2020-05-25 23:27:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9b41a156bf6e3e5c82c426650a4a0ab210ac5814
9b41a156
1 parent
4e7566fb
[Modify] Upload router & Logout router
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
14 deletions
controllers/userController.js
controllers/videoController.js
routers/videoRouter.js
views/login.pug
views/logout.pug
views/upload.pug
controllers/userController.js
View file @
9b41a15
...
...
@@ -23,8 +23,16 @@ export const getLogin = (req, res) =>
export
const
postLogin
=
(
req
,
res
)
=>
{
res
.
redirect
(
routes
.
home
);
};
export
const
logout
=
(
req
,
res
)
=>
res
.
render
(
"logout"
,
{
pageTitle
:
"Logout"
});
//로그아웃을 클릭하면 LogOut페이지로 가는 것 대신에, 로그아웃을 처리한 후
// home 페이지로 Redirect로 표현할 것이다.
//즉, 초반에 만들어둔 logout.pug는 삭제해도 좋다.
export
const
logout
=
(
req
,
res
)
=>
{
//res.render("logout", { pageTitle: "Logout" });
res
.
redirect
(
routes
.
home
);
};
export
const
users
=
(
req
,
res
)
=>
res
.
render
(
"users"
,
{
pageTitle
:
"Users"
});
export
const
userDetail
=
(
req
,
res
)
=>
res
.
render
(
"userDetail"
,
{
pageTitle
:
"User Detail"
});
...
...
controllers/videoController.js
View file @
9b41a15
import
{
videos
}
from
"../db"
;
import
routes
from
"../routes"
;
export
const
home
=
(
req
,
res
)
=>
{
res
.
render
(
"home"
,
{
pageTitle
:
"Home"
,
videos
});
};
...
...
@@ -10,7 +12,19 @@ export const search = (req, res) => {
res
.
render
(
"search"
,
{
pageTitle
:
"Search"
,
searchingBy
,
videos
});
};
export
const
upload
=
(
req
,
res
)
=>
res
.
render
(
"upload"
,
{
pageTitle
:
"Upload"
});
//upload 또한 upload를 준비하기 위한 get 페이지와 실제 데이터를 보내는 post 페이지가 필요하다.
export
const
getUpload
=
(
req
,
res
)
=>
res
.
render
(
"upload"
,
{
pageTitle
:
"Upload"
});
export
const
postUpload
=
(
req
,
res
)
=>
{
//const {} 를 통해 body를 받아와 요청하는 정보들을 확인한다.
//이는 pug와 db.js를 확인해야하는 듯 하다.
const
{
body
:
{
file
,
title
,
description
},
}
=
req
;
res
.
redirect
(
routes
.
videoDetail
(
324393
));
};
export
const
videoDetail
=
(
req
,
res
)
=>
res
.
render
(
"videoDetail"
,
{
pageTitle
:
"Video Detail"
});
export
const
editVideo
=
(
req
,
res
)
=>
res
.
render
(
"editVideo"
,
{
pageTitle
:
"Edit Video"
});
export
const
deleteVideo
=
(
req
,
res
)
=>
res
.
render
(
"deleteVideo"
,
{
pageTitle
:
"Delete Video"
});
\ No newline at end of file
...
...
routers/videoRouter.js
View file @
9b41a15
import
express
from
"express"
;
import
routes
from
"../routes"
;
import
{
upload
,
getUpload
,
postUpload
,
videoDetail
,
editVideo
,
deleteVideo
,
...
...
@@ -9,7 +10,9 @@ import {
//export const videoRouter = express.Router(); 이렇게하면 이 변수만 export하게 된다.
const
videoRouter
=
express
.
Router
();
videoRouter
.
get
(
routes
.
upload
,
upload
);
videoRouter
.
get
(
routes
.
upload
,
getUpload
);
videoRouter
.
post
(
routes
.
upload
,
postUpload
);
videoRouter
.
get
(
routes
.
editVideo
,
editVideo
);
...
...
views/login.pug
View file @
9b41a15
...
...
@@ -3,7 +3,7 @@ extends layouts/main
block content
.form-container
form(action=routes.login, method="post")
input(type="email", name="email", placeholder="Email")
input(type="password", name="password", placeholder="Password")
input(type="email", name="email", placeholder="Email"
, required=true
)
input(type="password", name="password", placeholder="Password"
, required=true
)
input(type="submit", value="Log In")
include partials/socialLogin
\ No newline at end of file
...
...
views/logout.pug
deleted
100644 → 0
View file @
4e7566f
extends layouts/main
block content
p Hello This is Logout
\ No newline at end of file
views/upload.pug
View file @
9b41a15
...
...
@@ -4,7 +4,7 @@ block content
.form-container
form(action=`/videos${routes.upload}`, method="post")
label(for="file") Video File
input(type="file", id="file", name="file")
input(type="text", placeholder="Title", name="title")
textarea(name="description", placeholder="Description")
input(type="file", id="file", name="file"
, required=true
)
input(type="text", placeholder="Title", name="title"
, required=true
)
textarea(name="description", placeholder="Description"
, required=true
)
input(type="submit", value="Upload Video")
\ No newline at end of file
...
...
Please
register
or
login
to post a comment