Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이세진
/
dev-profile
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
10
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Lee SeJin
2021-05-11 01:34:51 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
30e0a124c0a606fdb9299eb7ae191b1e22b1650e
30e0a124
1 parent
bd71676c
quote api update
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
139 additions
and
19 deletions
package.json
src/controllers/userController.js
src/routers/globalRouter.js
src/routers/userRouter.js
src/server.js
src/views/editProfile.pug
src/views/home.pug
src/views/join.pug
src/views/layouts/main.pug
src/views/login.pug
src/views/partials/footer.pug
src/views/partials/header.pug
src/views/userDetail.pug
package.json
View file @
30e0a12
...
...
@@ -15,6 +15,7 @@
"@babel/core"
:
"^7.14.0"
,
"@babel/node"
:
"^7.13.13"
,
"@babel/preset-env"
:
"^7.14.1"
,
"axios"
:
"^0.21.1"
,
"express"
:
"^4.17.1"
,
"morgan"
:
"^1.10.0"
,
"nodemon"
:
"^2.0.7"
,
...
...
src/controllers/userController.js
View file @
30e0a12
export
const
handleHome
=
(
req
,
res
)
=>
{
const
list1
=
[
1
,
2
,
3
,
4
,
5
]
res
.
render
(
"home"
,{
pageTitle
:
"Home"
,
list1
});
import
axios
from
"axios"
;
const
getQuote
=
async
(
req
,
res
)
=>
{
const
url
=
"http://quotes.stormconsultancy.co.uk/random.json"
;
const
quoteData
=
await
axios
.
get
(
url
).
then
(
function
(
response
){
return
response
.
data
;
});
const
quote
=
quoteData
.
quote
;
const
author
=
quoteData
.
author
;
return
{
quote
,
author
};
}
export
const
handleHome
=
async
(
req
,
res
)
=>
{
const
quote
=
await
getQuote
();
res
.
render
(
"home"
,{
pageTitle
:
"Home"
,
quote
:
quote
.
quote
,
author
:
quote
.
author
});
}
export
const
getUserDetail
=
async
(
req
,
res
)
=>
{
const
quote
=
await
getQuote
();
res
.
render
(
"userDetail"
,{
pagetTitle
:
"User Detail"
,
quote
:
quote
.
quote
,
author
:
quote
.
author
})
}
export
const
getEditProfile
=
(
req
,
res
)
=>
res
.
render
(
"editProfile"
,{
pageTitle
:
"Edit Profile"
});
export
const
postEditProfile
=
(
req
,
res
)
=>
{
console
.
log
(
req
.
body
);
res
.
redirect
(
"/users/edit-profile"
);
};
export
const
getJoin
=
(
req
,
res
)
=>
{
res
.
render
(
"join"
,{
pageTitle
:
"Join"
});
};
export
const
getLogin
=
(
req
,
res
)
=>
{
res
.
render
(
"login"
,{
pageTitle
:
"Login"
});
};
export
const
handleUsers
=
(
req
,
res
)
=>
{
res
.
render
(
"users"
,{
pageTitle
:
"Users"
});
}
...
...
src/routers/globalRouter.js
View file @
30e0a12
import
express
from
"express"
;
import
{
handleHome
}
from
"../controllers/userController"
;
import
{
getJoin
,
getLogin
,
handleHome
}
from
"../controllers/userController"
;
const
globalRouter
=
express
.
Router
();
globalRouter
.
get
(
"/"
,
handleHome
);
globalRouter
.
get
(
"/join"
,
(
req
,
res
)
=>
res
.
render
(
"join"
)
);
globalRouter
.
get
(
"/login"
,
(
req
,
res
)
=>
res
.
render
(
"login"
)
);
globalRouter
.
get
(
"/join"
,
getJoin
);
globalRouter
.
get
(
"/login"
,
getLogin
);
export
default
globalRouter
;
\ No newline at end of file
...
...
src/routers/userRouter.js
View file @
30e0a12
import
express
from
"express"
;
import
{
handleUsers
}
from
"../controllers/userController"
;
import
{
getEditProfile
,
getUserDetail
,
handleUsers
,
postEditProfile
}
from
"../controllers/userController"
;
const
userRouter
=
express
.
Router
();
userRouter
.
get
(
"/"
,
handleUsers
);
userRouter
.
get
(
"/edit-profile"
,(
req
,
res
)
=>
res
.
render
(
"editProfile"
));
userRouter
.
get
(
"/:id"
,(
req
,
res
)
=>
res
.
render
(
"userDetail"
));
userRouter
.
get
(
"/edit-profile"
,
getEditProfile
);
userRouter
.
post
(
"/edit-profile"
,
postEditProfile
);
userRouter
.
get
(
"/:id"
,
getUserDetail
);
export
default
userRouter
;
\ No newline at end of file
...
...
src/server.js
View file @
30e0a12
...
...
@@ -13,6 +13,8 @@ app.set("view engine","pug");
app
.
set
(
"views"
,
path
.
join
(
__dirname
,
"views"
));
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
"static"
)));
app
.
use
(
morgan
(
"dev"
));
app
.
use
(
express
.
json
());
app
.
use
(
express
.
urlencoded
({
extended
:
true
}));
app
.
use
(
localsMiddleware
);
...
...
@@ -24,3 +26,4 @@ app.use("/users", userRouter);
const
handleListening
=
()
=>
console
.
log
(
`✅ Server running : http://localhost:
${
PORT
}
`
);
app
.
listen
(
PORT
,
handleListening
);
...
...
src/views/editProfile.pug
View file @
30e0a12
h1 edit Profile
\ No newline at end of file
extends layouts/main
block content
.form-container
form(action="/users/edit-profile", method="POST", enctype="application/json")
.fileUpload
label(for="picture") Picture
input(type="file", id="picture", name="picture", accept="image/*")
input(type="text", placeholder="Name", name="name")
input(type="text", placeholder="Github Id", name="githubId")
input(type="email", placeholder="Email", name="email")
input(type="text", placeholder="School", name="school")
textarea(name="tech", placeholder="Add your Tech")
textarea(name="career", placeholder="Add your Career")
textarea(name="introduction", placeholder="Self introduction")
input(type="submit", value="Update Profile")
\ No newline at end of file
...
...
src/views/home.pug
View file @
30e0a12
extends layouts/main
block content
h1 Welcome
each item in list1
span=item
\ No newline at end of file
.home
.home-title
h2 Develop your value
h1 -Developer Profile-
h2=quote
h3=author
.home-link
a(href="/join") Join
a(href="/login") Login
...
...
src/views/join.pug
View file @
30e0a12
h1 join
\ No newline at end of file
extends layouts/main
block content
i.fas.fa-location-arrow
h3 Start with GitHub!
button.login-github
a(href="#")
span
i.fab.fa-github
|Join with GitHub
\ No newline at end of file
...
...
src/views/layouts/main.pug
View file @
30e0a12
doctype html
html
head
link(rel="stylesheet", href="https://use.fontawesome.com/releases/v5.15.2/css/all.css", integrity="sha384-vSIIfh2YWi9wW0r9iZe7RJPrKwp6bG+s9QZMoITbCckVJqGCCRhc+ccxNcdpHuYu", crossorigin="anonymous")
meta(charset="UTF-8")
title #{pageTitle} | #{siteName}
link(rel="stylesheet", href="
/static/main
.css")
link(rel="stylesheet", href="
https://unpkg.com/mvp
.css")
body
include ../partials/header
main
block content
include ../partials/footer
//- script(src="/static/main.js")
...
...
src/views/login.pug
View file @
30e0a12
h1 Login
\ No newline at end of file
extends layouts/main
block content
i.fas.fa-location-arrow
h3 Login with GitHub!
button.login-github
a(href="#")
span
i.fab.fa-github
|Login with GitHub
\ No newline at end of file
...
...
src/views/partials/footer.pug
View file @
30e0a12
footer.footer
.footer__icon
i.fas.fa-code-branch
span.footer__text dev-profile #{new Date().getFullYear()} ©
\ No newline at end of file
span.footer__text © dev-profile #{new Date().getFullYear()}
\ No newline at end of file
...
...
src/views/partials/header.pug
View file @
30e0a12
...
...
@@ -3,6 +3,10 @@ header.header
.header__column
ul
li
a(href="/") Home
li
a(href="/join") Join
li
a(href="/login") Log In
li
a(href="/users/edit-profile") Edit Profile
\ No newline at end of file
...
...
src/views/userDetail.pug
View file @
30e0a12
h1 User Detail
\ No newline at end of file
extends layouts/main
block content
h1 User Detail
.user-quote
h2=quote
h3=author
.user-profile
.user-profile__column
img(src="#")
.user-profile__link
a(href="#") Github
a(href="#") Blog
.user-profile__column
.user-profile__info
h3 NAME
h3 GITHUB NICKNAME
h3 EMAIL
h3 SCHOOL
h3 TECH
h3 CAREER
h3 SELF-INTRODUCTION
.user-status
.user-status__contributions
img(src="http://ghchart.rshah.org/lsj8706" alt="Name Your Github chart")
.user-status__character
h3 Your step | commit numbers
img(src="https://preview.free3d.com/img/2019/12/2269306250288170045/1oe8ymrc-900.jpg" alt="character" style="height:200px; width:250px;")
.user-repositories
.user-repo
h3 REPO 1
\ No newline at end of file
...
...
Please
register
or
login
to post a comment