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
eue
Commits
2c0524e1
Commit
2c0524e1
authored
Jul 20, 2021
by
KangMin An
Browse files
Update : 지역 코드 외부 요청 인가.
parent
19b7c6c2
Changes
3
Show whitespace changes
Inline
Side-by-side
server/package.json
View file @
2c0524e1
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
"@babel/preset-env"
:
"^7.11.5"
,
"@babel/preset-env"
:
"^7.11.5"
,
"body-parser"
:
"^1.19.0"
,
"body-parser"
:
"^1.19.0"
,
"cookie-parser"
:
"^1.4.5"
,
"cookie-parser"
:
"^1.4.5"
,
"cors"
:
"^2.8.5"
,
"dotenv"
:
"^8.2.0"
,
"dotenv"
:
"^8.2.0"
,
"express"
:
"^4.17.1"
,
"express"
:
"^4.17.1"
,
"helmet"
:
"^4.1.1"
,
"helmet"
:
"^4.1.1"
,
...
...
server/src/app.js
View file @
2c0524e1
import
cookieParser
from
"
cookie-parser
"
;
import
cookieParser
from
"
cookie-parser
"
;
import
cors
from
"
cors
"
;
import
express
from
"
express
"
;
import
express
from
"
express
"
;
import
morgan
from
"
morgan
"
;
import
morgan
from
"
morgan
"
;
import
helmet
from
"
helmet
"
;
import
helmet
from
"
helmet
"
;
...
@@ -17,6 +18,7 @@ const app = express();
...
@@ -17,6 +18,7 @@ const app = express();
app
.
set
(
"
view engine
"
,
"
pug
"
);
app
.
set
(
"
view engine
"
,
"
pug
"
);
app
.
set
(
"
views
"
,
path
.
join
(
__dirname
,
"
views
"
));
app
.
set
(
"
views
"
,
path
.
join
(
__dirname
,
"
views
"
));
app
.
use
(
cors
());
app
.
use
(
helmet
());
app
.
use
(
helmet
());
app
.
use
(
cookieParser
());
app
.
use
(
cookieParser
());
app
.
use
(
express
.
json
());
app
.
use
(
express
.
json
());
...
...
server/src/controllers/dataController.js
View file @
2c0524e1
...
@@ -89,8 +89,45 @@ export const getUserWeatherData = (req, res) => {
...
@@ -89,8 +89,45 @@ export const getUserWeatherData = (req, res) => {
};
};
// 지역 코드 요청 처리
// 지역 코드 요청 처리
export
const
getLocCode
=
(
req
,
res
)
=>
{
export
const
getLocCode
=
async
(
req
,
res
)
=>
{
/* 통합 지역 코드 및 이름 json으로 생성 및 전송 */
/* 통합 지역 코드 및 이름 json으로 생성 및 전송 */
let
locCodes
=
[];
res
.
status
(
statusCode
.
ok
).
send
(
serverMSG
.
server_ok
);
const
does
=
await
db
.
Doe
.
findAll
({
logging
:
false
});
const
sggs
=
await
db
.
Sgg
.
findAll
({
logging
:
false
});
const
emds
=
await
db
.
Emd
.
findAll
({
logging
:
false
});
let
doe_sgg
=
[];
let
sgg_emd
=
[];
does
.
map
((
info_doe
)
=>
{
let
temp
=
{
name_doe
:
info_doe
[
"
name_doe
"
],
code_doe
:
info_doe
[
"
code_doe
"
],
};
temp
.
sgg
=
sggs
.
filter
(
(
info_sgg
)
=>
info_sgg
[
"
code_doe
"
]
===
info_doe
[
"
code_doe
"
]
);
doe_sgg
.
push
(
temp
);
});
sggs
.
map
((
info_sgg
)
=>
{
let
temp
=
{
code_doe
:
info_sgg
[
"
code_doe
"
],
name_sgg
:
info_sgg
[
"
name_sgg
"
],
code_sgg
:
info_sgg
[
"
code_sgg
"
],
};
temp
.
emd
=
emds
.
filter
(
(
info_emd
)
=>
info_emd
[
"
code_sgg
"
]
===
info_sgg
[
"
code_sgg
"
]
);
sgg_emd
.
push
(
temp
);
});
res
.
status
(
statusCode
.
ok
).
json
({
locCodes
:
{
DOE
:
does
,
SGG
:
doe_sgg
,
EMD
:
sgg_emd
,
},
});
};
};
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