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
quiz-competition
Commits
e7c36007
Commit
e7c36007
authored
Oct 01, 2020
by
Yoon, Daeki
😅
Browse files
server routes 정리
parent
75cdec2c
Changes
4
Show whitespace changes
Inline
Side-by-side
src/client/src/MainRouter.jsx
View file @
e7c36007
...
...
@@ -30,9 +30,9 @@ function MainRouter() {
<
Route
path
=
"/quiz/by/:userId"
>
<
Quizzes
/>
</
Route
>
{
/*
<Route path="/quiz/problem/new
/:quizId
">
<
Route
path
=
"/quiz/problem/new"
>
<
NewProblem
/>
</Route>
*/
}
</
Route
>
<
Route
path
=
"/quiz/problem/edit/:problemId"
>
<
EditProblem
/>
</
Route
>
...
...
src/client/src/quiz/NewProblem.jsx
View file @
e7c36007
...
...
@@ -5,7 +5,6 @@ import Col from "react-bootstrap/Col";
import
{
useParams
}
from
"
react-router-dom
"
;
function
NewProblem
({
addProblem
})
{
const
{
quizId
}
=
useParams
();
const
[
answers
,
setAnswers
]
=
useState
([
""
]);
const
[
question
,
setQuestion
]
=
useState
(
""
);
...
...
src/client/src/quiz/api-quiz.js
View file @
e7c36007
const
create
=
async
(
params
,
credentials
,
quiz
)
=>
{
try
{
let
response
=
await
fetch
(
'
/api/quiz/
by/
'
+
params
.
userId
,
{
let
response
=
await
fetch
(
'
/api/quiz/
'
+
params
.
userId
,
{
method
:
'
POST
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
...
...
@@ -18,7 +18,7 @@ const create = async (params, credentials, quiz) => {
const
read
=
async
(
params
,
credentials
,
signal
)
=>
{
try
{
let
response
=
await
fetch
(
'
/api/quiz/
'
+
params
.
quizId
,
{
let
response
=
await
fetch
(
'
/api/quiz/
by/
'
+
params
.
quizId
,
{
method
:
'
GET
'
,
signal
:
signal
,
headers
:
{
...
...
@@ -35,7 +35,7 @@ const read = async (params, credentials, signal) => {
const
readProblem
=
async
(
params
,
credentials
,
signal
)
=>
{
try
{
let
response
=
await
fetch
(
'
/api/quiz/problem/
'
+
params
.
problemId
,
{
let
response
=
await
fetch
(
'
/api/quiz/problem/
by/
'
+
params
.
problemId
,
{
method
:
'
GET
'
,
signal
:
signal
,
headers
:
{
...
...
@@ -52,7 +52,7 @@ const readProblem = async (params, credentials, signal) => {
const
updateProblem
=
async
(
params
,
credentials
,
problem
)
=>
{
try
{
let
response
=
await
fetch
(
'
/api/quiz/problem/
'
+
params
.
problemId
,
{
let
response
=
await
fetch
(
'
/api/quiz/problem/
by/
'
+
params
.
problemId
,
{
method
:
'
PUT
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
...
...
@@ -69,7 +69,7 @@ const updateProblem = async (params, credentials, problem) => {
const
removeProblem
=
async
(
params
,
credentials
)
=>
{
try
{
let
response
=
await
fetch
(
'
/api/quiz/problem/
'
+
params
.
problemId
,
{
let
response
=
await
fetch
(
'
/api/quiz/problem/
by/
'
+
params
.
problemId
,
{
method
:
'
DELETE
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
...
...
@@ -85,7 +85,7 @@ const removeProblem = async (params, credentials) => {
const
listByUserId
=
async
(
params
,
credentials
,
signal
)
=>
{
try
{
let
response
=
await
fetch
(
'
/api/quiz/
by/
'
+
params
.
userId
,
{
let
response
=
await
fetch
(
'
/api/quiz/
'
+
params
.
userId
,
{
method
:
'
GET
'
,
signal
:
signal
,
headers
:
{
...
...
src/server/quiz/quiz.routes.js
View file @
e7c36007
...
...
@@ -5,14 +5,17 @@ import quizCtrl from './quiz.controller.js'
const
router
=
express
.
Router
()
router
.
route
(
'
/api/quiz/
by/
:userId
'
)
router
.
route
(
'
/api/quiz/:userId
'
)
.
post
(
authCtrl
.
requireSignin
,
authCtrl
.
hasAuthorization
,
userCtrl
.
isInstructor
,
quizCtrl
.
create
)
.
get
(
authCtrl
.
requireSignin
,
authCtrl
.
hasAuthorization
,
quizCtrl
.
listByUserId
)
router
.
route
(
'
/api/quiz/:quizId
'
)
router
.
route
(
'
/api/quiz/
by/
:quizId
'
)
.
get
(
authCtrl
.
requireSignin
,
quizCtrl
.
isAuthor
,
quizCtrl
.
read
)
router
.
route
(
'
/api/quiz/problem/:problemId
'
)
router
.
route
(
'
/api/quiz/problem/:userId
'
)
.
post
(
authCtrl
.
requireSignin
,
userCtrl
.
isInstructor
)
router
.
route
(
'
/api/quiz/problem/by/:problemId
'
)
.
get
(
authCtrl
.
requireSignin
,
quizCtrl
.
isProblemAuthor
,
quizCtrl
.
readProblem
)
.
put
(
authCtrl
.
requireSignin
,
quizCtrl
.
isProblemAuthor
,
quizCtrl
.
updateProblem
)
.
delete
(
authCtrl
.
requireSignin
,
quizCtrl
.
isProblemAuthor
,
quizCtrl
.
removeProblem
)
...
...
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