Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
1e98d45b
Commit
1e98d45b
authored
Jan 16, 2021
by
우지원
Browse files
a
parent
c349c1c2
Changes
2
Show whitespace changes
Inline
Side-by-side
server/controllers/user.controller.js
View file @
1e98d45b
...
@@ -43,10 +43,6 @@ const signup = async (req, res) => {
...
@@ -43,10 +43,6 @@ const signup = async (req, res) => {
res
.
status
(
500
).
send
(
'
회원가입 에러발생하였습니다.
'
)
res
.
status
(
500
).
send
(
'
회원가입 에러발생하였습니다.
'
)
}
}
}
}
const
hello
=
async
(
req
,
res
)
=>
{
let
users
=
await
User
.
find
().
select
(
'
name nickname email _id
'
).
exec
()
return
res
.
json
(
users
)
}
const
logineduser
=
async
(
req
,
res
)
=>
{
const
logineduser
=
async
(
req
,
res
)
=>
{
try
{
try
{
...
@@ -60,7 +56,7 @@ const logineduser = async (req, res) => {
...
@@ -60,7 +56,7 @@ const logineduser = async (req, res) => {
const
changenick
=
async
(
req
,
res
)
=>
{
const
changenick
=
async
(
req
,
res
)
=>
{
try
{
try
{
const
newnick
=
req
.
body
.
nickname
const
newnick
=
req
.
body
.
nickname
await
User
.
update
({
'
username
'
:
req
.
body
.
username
},
{
'
nickname
'
:
newnick
})
await
User
.
update
One
({
'
username
'
:
req
.
body
.
username
},
{
'
nickname
'
:
newnick
})
}
catch
(
error
)
{
}
catch
(
error
)
{
alert
(
'
올바르지 못한 접근입니다.
'
)
alert
(
'
올바르지 못한 접근입니다.
'
)
}
}
...
@@ -75,25 +71,5 @@ const loginNavbar = async (req, res) => {
...
@@ -75,25 +71,5 @@ const loginNavbar = async (req, res) => {
}
}
}
}
// const getNav = (req, res) => {
export
default
{
signup
,
logineduser
,
changenick
,
loginNavbar
}
// res.json(req.loginNav)
// }
// const userById = async (req, res, next, id) => {
// try {
// const user = await User.findById(id)
// if (!user) {
// res.status(404).send('사용자를 찾을 수 없습니다.')
// }
// req.loginNav = user
// //req에 profile을 만들어서 user를 저장해줌
// next()
// //다음 middleware로 이동시킴 / 없으면 멈춤
// } catch (error) {
// console.log(error)
// res.status(500).send('사용자 아이디 검색 실패')
// }
// }
export
default
{
signup
,
hello
,
logineduser
,
changenick
,
loginNavbar
}
// {} : 객체로 return함
// {} : 객체로 return함
\ No newline at end of file
server/routes/user.routes.js
View file @
1e98d45b
...
@@ -6,7 +6,6 @@ const router = express.Router()
...
@@ -6,7 +6,6 @@ const router = express.Router()
router
.
route
(
'
/users/signup
'
)
router
.
route
(
'
/users/signup
'
)
.
post
(
userCtrl
.
signup
)
.
post
(
userCtrl
.
signup
)
.
get
(
userCtrl
.
hello
)
router
.
route
(
`/users/:userId`
)
router
.
route
(
`/users/:userId`
)
.
post
(
userCtrl
.
logineduser
)
.
post
(
userCtrl
.
logineduser
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment