Commit 1e98d45b authored by 우지원's avatar 우지원
Browse files

a

parent c349c1c2
...@@ -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.updateOne({ '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
...@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment