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
search-page
Commits
8bd19e51
Commit
8bd19e51
authored
Jan 24, 2021
by
Lee SeoYeon
Browse files
.
parent
94ab062d
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
client/.eslintcache
View file @
8bd19e51
This diff is collapsed.
Click to expand it.
server/controllers/user.controller.js
View file @
8bd19e51
...
...
@@ -2,7 +2,6 @@ import User from "../models/User.js"
import
isLength
from
'
validator/lib/isLength.js
'
import
isEmail
from
"
validator/lib/isEmail.js
"
import
bcrypt
from
"
bcryptjs
"
;
const
reviews
=
(
"
../models/Review.js
"
);
const
signup
=
async
(
req
,
res
)
=>
{
const
{
name
,
email
,
password
}
=
req
.
body
//구조분해해서 하나씩
...
...
@@ -61,35 +60,4 @@ const userById = async (req, res, next, id) => {
// }
// }
const
bookMark
=
async
(
req
,
res
,
next
)
=>
{
const
{
title
,
link
,
content
}
=
req
.
body
;
// 비구조화 할당
console
.
log
(
req
.
body
);
let
bookmark
=
[]
const
newBookmark
=
await
new
Bookmark
({
}).
save
()
var
reviewModel
=
new
reviews
();
reviewModel
.
title
=
title
;
reviewModel
.
content
=
content
;
reviewModel
.
link
=
link
;
reviewModel
.
save
()
.
then
(
newReview
=>
{
console
.
log
(
"
Create 완료
"
);
res
.
status
(
200
).
json
({
message
:
"
Create success
"
,
data
:
{
review
:
newReview
}
});
})
.
catch
(
err
=>
{
res
.
status
(
500
).
json
({
message
:
err
});
});
};
export
default
{
signup
,
userById
,
bookMark
}
\ No newline at end of file
export
default
{
signup
,
userById
}
\ No newline at end of file
server/models/User.js
View file @
8bd19e51
...
...
@@ -3,6 +3,16 @@ import mongoose from "mongoose";
const
{
String
}
=
mongoose
.
Schema
.
Types
const
{
Array
}
=
mongoose
.
Schema
.
Types
const
{
Schema
}
=
mongoose
;
const
{
Types
:
{
ObjectId
}
}
=
Schema
;
const
ReserveSchema
=
new
Schema
({
user
:
{
type
:
ObjectId
,
required
:
true
,
ref
:
'
User
'
,
},
})
const
UserSchema
=
new
mongoose
.
Schema
({
name
:
{
type
:
String
,
...
...
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