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
reservation-service
Commits
0e979e43
Commit
0e979e43
authored
Sep 20, 2020
by
Kim, Subin
Browse files
Merge remote-tracking branch 'origin/NewMaster' into kimpen
parents
7393930d
32dcbf22
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
server/app.js
View file @
0e979e43
...
...
@@ -44,4 +44,4 @@ app.use(function(err, req, res, next) {
// res.render('error');
});
module
.
exports
=
app
;
\ No newline at end of file
module
.
exports
=
app
;
server/client/package-lock.json
View file @
0e979e43
This diff is collapsed.
Click to expand it.
server/client/package.json
View file @
0e979e43
...
...
@@ -24,6 +24,7 @@
"test"
:
"react-scripts test"
,
"eject"
:
"react-scripts eject"
},
"proxy"
:
"http://localhost:3030"
,
"eslintConfig"
:
{
"extends"
:
"react-app"
},
...
...
@@ -38,6 +39,5 @@
"last 1 firefox version"
,
"last 1 safari version"
]
},
"proxy"
:
"http://localhost:3030"
}
}
server/client/src/index.js
View file @
0e979e43
...
...
@@ -26,18 +26,6 @@ ReactDOM.render(
document
.
getElementById
(
'
root
'
)
);
// ReactDOM.render(
// <Router>
// <Switch>
// <Route exact path="/" component={Login} />
// <Route path="/home" component={Home} />
// </Switch>
// </Router>,
// document.getElementById('root')
// );
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
...
...
server/schemas/index.js
View file @
0e979e43
...
...
@@ -26,4 +26,4 @@ module.exports = () => {
require
(
'
./user
'
);
require
(
'
./reserve
'
);
};
\ No newline at end of file
};
server/schemas/reserve.js
View file @
0e979e43
...
...
@@ -31,4 +31,4 @@ const reserveSchema = new Schema({
}
});
module
.
exports
=
mongoose
.
model
(
'
Reserve
'
,
reserveSchema
);
\ No newline at end of file
module
.
exports
=
mongoose
.
model
(
'
Reserve
'
,
reserveSchema
);
server/schemas/user.js
View file @
0e979e43
const
mongoose
=
require
(
'
mongoose
'
);
const
bcrypt
=
require
(
"
bcrypt
"
);
const
saltRounds
=
10
;
const
{
Schema
}
=
mongoose
;
const
userSchema
=
new
Schema
({
id
:
{
type
:
Number
,
unique
:
true
,
},
password
:
{
name
:
{
type
:
String
,
required
:
true
,
},
name
:
{
password
:
{
type
:
String
,
}
},
id
:
{
type
:
Number
,
required
:
true
,
},
});
userSchema
.
pre
(
"
save
"
,
function
(
next
)
{
let
user
=
this
;
//User모델 자체를 가르킴.
//model 안의 paswsword가 변경 또는 생성될 때 암호화
if
(
user
.
isModified
(
"
password
"
))
{
bcrypt
.
genSalt
(
saltRounds
,
function
(
err
,
salt
)
{
if
(
err
)
return
next
(
err
);
bcrypt
.
hash
(
user
.
password
,
salt
,
function
(
err
,
hash
)
{
if
(
err
)
return
next
(
err
);
user
.
password
=
hash
;
next
();
});
});
}
else
{
next
();
}
});
module
.
exports
=
mongoose
.
model
(
'
User
'
,
userSchema
);
\ No newline at end of file
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