Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Add to json current timetable info field
Browse files Browse the repository at this point in the history
  • Loading branch information
CXZ7720 authored and AnOldStory committed Mar 27, 2020
1 parent 30159b6 commit e08eedc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion router/giksa.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ router.get('/', (req, res) => {
console.log(err)
return res.status(404).json({ error: 'Incorrect column' })
}
const jsondata = JSON.parse(data)
let jsondata = JSON.parse(data)
jsondata.datekind = datekind
jsondata.daykind = daykind

console.log(jsondata)
if (daykind == 'week') { //주중일 경우
return res.json(jsondata.residence_week)
} else { //주말일 경우
Expand Down
4 changes: 3 additions & 1 deletion router/shuttlecock_i.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ router.get('/', (req, res) => {
console.log(err)
return res.status(404).json({ error: 'Incorrect column' })
}
const jsondata = JSON.parse(data)
let jsondata = JSON.parse(data);
jsondata.datekind = datekind;
jsondata.daykind = daykind;
if (daykind == 'week') { //주중일 경우
return res.json(jsondata.shuttlecock_i_week)
} else { //주말일 경우
Expand Down
4 changes: 3 additions & 1 deletion router/shuttlecock_o.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ router.get('/', (req, res) => {
console.log(err)
return res.status(404).json({ error: 'Incorrect column' })
}
const jsondata = JSON.parse(data)
let jsondata = JSON.parse(data);
jsondata.datekind = datekind;
jsondata.daykind = daykind;
if (daykind == 'week') { //주중일 경우
return res.json(jsondata.shuttlecock_o_week)
} else { //주말일 경우
Expand Down
4 changes: 3 additions & 1 deletion router/subway.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ router.get('/', (req, res) => {
console.log(err)
return res.status(404).json({ error: 'Incorrect column' })
}
const jsondata = JSON.parse(data)
let jsondata = JSON.parse(data);
jsondata.datekind = datekind;
jsondata.daykind = daykind;
if(daykind == 'week'){ //주중일 경우
return res.json(jsondata.subway_week)
} else { //주말일 경우
Expand Down
5 changes: 4 additions & 1 deletion router/yesulin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ router.get('/', (req, res) => {
console.log(err)
return res.status(404).json({ error: 'Incorrect column' })
}
const jsondata = JSON.parse(data)
let jsondata = JSON.parse(data);
jsondata.datekind = datekind;
jsondata.daykind = daykind;

if (daykind == 'week') { //주중일 경우
return res.json(jsondata.yesulin_week)
} else { //주말일 경우
Expand Down

0 comments on commit e08eedc

Please sign in to comment.