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
f783563f
Commit
f783563f
authored
Jan 02, 2021
by
우지원
Browse files
Merge remote-tracking branch 'origin/soo-12-28' into jiweon827
parents
8953bd52
09af2954
Changes
9
Hide whitespace changes
Inline
Side-by-side
client/.gitignore
View file @
f783563f
...
@@ -21,5 +21,8 @@
...
@@ -21,5 +21,8 @@
npm-debug.log*
npm-debug.log*
yarn-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*
package-lock.json
package-lock.json
.eslintcache
.eslintcache
\ No newline at end of file
debug.log
.env
client/package.json
View file @
f783563f
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
"react-dom"
:
"^17.0.1"
,
"react-dom"
:
"^17.0.1"
,
"react-router-dom"
:
"^5.2.0"
,
"react-router-dom"
:
"^5.2.0"
,
"react-scripts"
:
"4.0.1"
,
"react-scripts"
:
"4.0.1"
,
"styled-components"
:
"^5.2.1"
,
"web-vitals"
:
"^0.2.4"
"web-vitals"
:
"^0.2.4"
},
},
"scripts"
:
{
"scripts"
:
{
...
...
client/src/App.js
View file @
f783563f
import
logo
from
'
./logo.svg
'
;
import
logo
from
'
./logo.svg
'
;
import
'
./App.css
'
;
import
'
./App.css
'
;
import
Hello
from
'
./Hello
'
;
function
App
()
{
function
App
()
{
return
(
return
(
<
div
className
=
"
App
"
>
<
Hello
name
=
'
대기
'
/>
<
header
className
=
"
App-header
"
>
<
img
src
=
{
logo
}
className
=
"
App-logo
"
alt
=
"
logo
"
/>
<
p
>
안녕하세요
<
/p
>
<
a
className
=
"
App-link
"
href
=
"
https://reactjs.org
"
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
>
Learn
React
<
/a
>
<
/header
>
<
/div
>
);
);
}
}
...
...
client/src/randCode.js
0 → 100644
View file @
f783563f
import
React
,
{
useState
}
from
'
react
'
;
function
randCode
(){
// const [ranNumArr,setRanNumArr] = useState([]);
const
min
=
1
;
const
max
=
99999
;
let
newNum
=
Math
.
floor
((
Math
.
random
()
*
max
)
+
min
);
// for (let i=0;i<ranNumArr.length;i++){
// if (ranNumArr[i]==newNum){
// newNum = Math.floor((Math.random()*max)+min);
// }
// }
let
zeroSize
=
""
;
for
(
let
j
=
0
;
j
<
5
-
newNum
.
toString
().
length
;
j
++
){
zeroSize
+=
"
0
"
;
}
// setRanNumArr(zeroSize+newNum);
return
(
zeroSize
+
newNum
.
toString
());
}
export
default
randCode
;
\ No newline at end of file
package.json
View file @
f783563f
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"type"
:
"module"
,
"type"
:
"module"
,
"scripts"
:
{
"scripts"
:
{
"
dev"
:
"nodemon server/server.js
"
,
"
test"
:
"echo
\"
Error: no test specified
\"
&& exit 1
"
,
"
test"
:
"echo
\"
Error: no test specified
\"
&& exit 1
"
"
dev"
:
"nodemon index.js
"
},
},
"repository"
:
{
"repository"
:
{
"type"
:
"git"
,
"type"
:
"git"
,
...
...
server/controllers/User.controllers.js
0 → 100644
View file @
f783563f
import
User
from
"
../models/User.js
"
import
isLength
from
'
validator/lib/isLength.js
'
const
signup
=
async
(
req
,
res
)
=>
{
const
{
name
,
email
,
password
}
=
req
.
body
try
{
if
(
!
isLength
(
name
,
{
min
:
3
,
max
:
10
}))
{
return
res
.
status
(
422
).
send
(
'
Name must be 3-10 characters
'
)
}
const
newUser
=
await
new
User
({
name
,
email
,
password
}).
save
()
console
.
log
(
newUser
)
res
.
json
(
newUser
)
}
catch
(
error
)
{
console
.
log
(
error
)
res
.
status
(
500
).
send
(
'
User signup error
'
)
}
}
const
hello
=
(
req
,
res
)
=>
{
res
.
send
(
'
Hello from users controller
'
)
}
export
default
{
signup
,
hello
}
\ No newline at end of file
server/models/User.js
View file @
f783563f
...
@@ -45,4 +45,4 @@ const UserSchema = new mongoose.Schema({
...
@@ -45,4 +45,4 @@ const UserSchema = new mongoose.Schema({
})
})
export
default
mongoose
.
models
.
User
||
mongoose
.
model
(
'
User
'
,
UserSchema
)
export
default
mongoose
.
models
.
User
||
mongoose
.
model
(
'
User
'
,
UserSchema
)
//user라는 이름이 있으면 앞을 return하고 없으면 뒤를 실행함
//user라는 이름이 있으면 앞을 return하고 없으면 뒤를 실행함
\ No newline at end of file
server/models/chat.js
0 → 100644
View file @
f783563f
import
mongoose
from
'
mongoose
'
const
{
String
}
=
mongoose
.
Schema
.
Types
const
ChatSchema
=
new
mongoose
.
Schema
({
name
:
{
type
:
String
,
required
:
true
,
},
interest
:
{
type
:
String
,
required
:
true
,
select
:
false
},
isOpen
:
{
type
:
String
,
required
:
true
,
default
:
'
user
'
,
enum
:
[
'
user
'
,
'
admin
'
,
'
root
'
]
}
},
{
timestamps
:
true
})
export
default
mongoose
.
models
.
User
||
mongoose
.
model
(
'
chat
'
,
ChatSchema
)
\ No newline at end of file
server/routes/User.routers.js
0 → 100644
View file @
f783563f
import
express
from
'
express
'
import
userCtrl
from
'
../controllers/user.controllers.js
'
const
router
=
express
.
Router
()
router
.
route
(
'
/api/users/signup
'
)
.
post
(
userCtrl
.
signup
)
.
get
(
userCtrl
.
hello
)
export
default
router
\ 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