신원형

main

1 +FROM node:latest
2 +
3 +LABEL project="OSS Demo image"
4 +LABEL maintainer "."
5 +
6 +RUN apt-get update
7 +
8 +WORKDIR /usr/app
9 +COPY ./ /usr/app
10 +
11 +EXPOSE 8110
12 +RUN npm install
13 +CMD [ "npm","start" ]
14 +RUN cd /usr/app
15 +RUN ls -a
...\ No newline at end of file ...\ No newline at end of file
...@@ -78,6 +78,15 @@ function filter_date(date, id, pw) { ...@@ -78,6 +78,15 @@ function filter_date(date, id, pw) {
78 78
79 return null 79 return null
80 } 80 }
81 +
82 +function is_good_weather(weather_data) {
83 + if(weather_data.id < 800) {
84 + return false
85 + }
86 +
87 + return true
88 +}
89 +
81 /* 90 /*
82 91
83 1. 사용자가 아무 메세지나 입력? 92 1. 사용자가 아무 메세지나 입력?
...@@ -108,11 +117,14 @@ app.post('/hook', async function (req, res) { ...@@ -108,11 +117,14 @@ app.post('/hook', async function (req, res) {
108 sendText(eventObj.replyToken, filter_result) 117 sendText(eventObj.replyToken, filter_result)
109 } 118 }
110 119
111 - (await weather.get_weather_current()).then(it => { 120 + const good_weather = (await weather.get_weather_current()).then(it => {
112 - 121 + return is_good_weather(it)
113 }) 122 })
123 + if (!good_weather) {
124 + sendText(eventObj.replyToken, "날씨가 나쁨")
125 + }
114 126
115 - 127 +
116 128
117 res.sendStatus(200); 129 res.sendStatus(200);
118 }); 130 });
......