Showing
1 changed file
with
20 additions
and
21 deletions
... | @@ -10,8 +10,9 @@ app.use(bodyParser.urlencoded({ extended: false })); | ... | @@ -10,8 +10,9 @@ app.use(bodyParser.urlencoded({ extended: false })); |
10 | app.use(bodyParser.json()); | 10 | app.use(bodyParser.json()); |
11 | app.use(cors()); | 11 | app.use(cors()); |
12 | 12 | ||
13 | -let logid=null; | 13 | +let logData=null; |
14 | const uri = 'mongodb+srv://sjieu17:tjrwls147714@cluster0.lc6pe.mongodb.net/weather_briefing?retryWrites=true&w=majority'; | 14 | const uri = 'mongodb+srv://sjieu17:tjrwls147714@cluster0.lc6pe.mongodb.net/weather_briefing?retryWrites=true&w=majority'; |
15 | +var queryParams = '?' + encodeURIComponent('serviceKey') + '=3OcUyvx97Vx2YikiZ9IHyRQ6suapku7Xn8VlefQKQWrGIFOGaejhbevwagcubdHfSiQAqJwCV5lyIutw0%2BsppA%3D%3D'; /* Service Key*/ | ||
15 | // const uri = 'mongodb+srv://tahmkench:dkrldnsl7@cluster0.vzipl.mongodb.net/?retryWrites=true&w=majority'; | 16 | // const uri = 'mongodb+srv://tahmkench:dkrldnsl7@cluster0.vzipl.mongodb.net/?retryWrites=true&w=majority'; |
16 | 17 | ||
17 | let db = mongoose.connect(uri, (err) => { | 18 | let db = mongoose.connect(uri, (err) => { |
... | @@ -29,6 +30,23 @@ var UserSchema = new mongoose.Schema({ | ... | @@ -29,6 +30,23 @@ var UserSchema = new mongoose.Schema({ |
29 | gender:String | 30 | gender:String |
30 | }); | 31 | }); |
31 | 32 | ||
33 | +let mongo = require('mongoose'); | ||
34 | + | ||
35 | +let hi = mongo.connect(uri, (err) => { | ||
36 | + if (err) { | ||
37 | + console.log(err.message); | ||
38 | + } else { | ||
39 | + console.log('Succesfully Connected!'); | ||
40 | + } | ||
41 | +}); | ||
42 | + | ||
43 | +var clothesSchema = new mongo.Schema({ | ||
44 | + gender: Number, | ||
45 | + weather: Number, | ||
46 | + top: Array, | ||
47 | + bottom:Array | ||
48 | +}); | ||
49 | + | ||
32 | var Users = mongoose.model('users', UserSchema); | 50 | var Users = mongoose.model('users', UserSchema); |
33 | 51 | ||
34 | app.use(bodyParser.json()); | 52 | app.use(bodyParser.json()); |
... | @@ -96,7 +114,7 @@ else{ | ... | @@ -96,7 +114,7 @@ else{ |
96 | 114 | ||
97 | CurDay+=today.getDate().toString(); | 115 | CurDay+=today.getDate().toString(); |
98 | } | 116 | } |
99 | -console.log(tommorow); | 117 | + |
100 | //nx,ny구하기 | 118 | //nx,ny구하기 |
101 | const xlsx=require('xlsx') | 119 | const xlsx=require('xlsx') |
102 | const excel=xlsx.readFile('location.xlsx'); | 120 | const excel=xlsx.readFile('location.xlsx'); |
... | @@ -126,7 +144,6 @@ let a3=[], a4=[], a5=[], a6=[], a7=[], a8=[], a9=[], a10=[], a11=[], a12=[], a13 | ... | @@ -126,7 +144,6 @@ let a3=[], a4=[], a5=[], a6=[], a7=[], a8=[], a9=[], a10=[], a11=[], a12=[], a13 |
126 | app.post('/api/weather',(req,res)=>{ | 144 | app.post('/api/weather',(req,res)=>{ |
127 | queryParams = '?' + encodeURIComponent('serviceKey') + '=3OcUyvx97Vx2YikiZ9IHyRQ6suapku7Xn8VlefQKQWrGIFOGaejhbevwagcubdHfSiQAqJwCV5lyIutw0%2BsppA%3D%3D'; | 145 | queryParams = '?' + encodeURIComponent('serviceKey') + '=3OcUyvx97Vx2YikiZ9IHyRQ6suapku7Xn8VlefQKQWrGIFOGaejhbevwagcubdHfSiQAqJwCV5lyIutw0%2BsppA%3D%3D'; |
128 | var url = 'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'; | 146 | var url = 'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'; |
129 | - | ||
130 | const nx = req.body.dotX; | 147 | const nx = req.body.dotX; |
131 | const ny = req.body.dotY; | 148 | const ny = req.body.dotY; |
132 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ | 149 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ |
... | @@ -172,7 +189,6 @@ app.post('/api/weather',(req,res)=>{ | ... | @@ -172,7 +189,6 @@ app.post('/api/weather',(req,res)=>{ |
172 | result.push(Json); | 189 | result.push(Json); |
173 | i+=2; | 190 | i+=2; |
174 | } | 191 | } |
175 | - | ||
176 | let addressData = { | 192 | let addressData = { |
177 | address1 : req.body.address1, | 193 | address1 : req.body.address1, |
178 | address2 : req.body.address2, | 194 | address2 : req.body.address2, |
... | @@ -186,7 +202,6 @@ app.post('/api/weather',(req,res)=>{ | ... | @@ -186,7 +202,6 @@ app.post('/api/weather',(req,res)=>{ |
186 | app.post('/api/tommorrow',(req,res)=>{ | 202 | app.post('/api/tommorrow',(req,res)=>{ |
187 | queryParams = '?' + encodeURIComponent('serviceKey') + '=3OcUyvx97Vx2YikiZ9IHyRQ6suapku7Xn8VlefQKQWrGIFOGaejhbevwagcubdHfSiQAqJwCV5lyIutw0%2BsppA%3D%3D'; | 203 | queryParams = '?' + encodeURIComponent('serviceKey') + '=3OcUyvx97Vx2YikiZ9IHyRQ6suapku7Xn8VlefQKQWrGIFOGaejhbevwagcubdHfSiQAqJwCV5lyIutw0%2BsppA%3D%3D'; |
188 | var url = 'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'; | 204 | var url = 'http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'; |
189 | - | ||
190 | const nx = req.body.dotX; | 205 | const nx = req.body.dotX; |
191 | const ny = req.body.dotY; | 206 | const ny = req.body.dotY; |
192 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ | 207 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ |
... | @@ -236,8 +251,6 @@ app.post('/api/tommorrow',(req,res)=>{ | ... | @@ -236,8 +251,6 @@ app.post('/api/tommorrow',(req,res)=>{ |
236 | });//pop:강수확률 tmp:한시간 기온 | 251 | });//pop:강수확률 tmp:한시간 기온 |
237 | }); | 252 | }); |
238 | 253 | ||
239 | -let mongo = require('mongoose'); | ||
240 | - | ||
241 | // let cors = require('cors'); | 254 | // let cors = require('cors'); |
242 | // let app = express(); | 255 | // let app = express(); |
243 | 256 | ||
... | @@ -245,20 +258,6 @@ let mongo = require('mongoose'); | ... | @@ -245,20 +258,6 @@ let mongo = require('mongoose'); |
245 | // const uri = 'mongodb+srv://sjieu17:tjrwls147714@cluster0.lc6pe.mongodb.net/weather_briefing?retryWrites=true&w=majority'; | 258 | // const uri = 'mongodb+srv://sjieu17:tjrwls147714@cluster0.lc6pe.mongodb.net/weather_briefing?retryWrites=true&w=majority'; |
246 | //const uri = 'mongodb+srv://tahmkench:dkrldnsl7@cluster0.vzipl.mongodb.net/?retryWrites=true&w=majority'; | 259 | //const uri = 'mongodb+srv://tahmkench:dkrldnsl7@cluster0.vzipl.mongodb.net/?retryWrites=true&w=majority'; |
247 | 260 | ||
248 | -let hi = mongo.connect(uri, (err) => { | ||
249 | - if (err) { | ||
250 | - console.log(err.message); | ||
251 | - } else { | ||
252 | - console.log('Succesfully Connected!'); | ||
253 | - } | ||
254 | -}); | ||
255 | -var clothesSchema = new mongo.Schema({ | ||
256 | - gender: Number, | ||
257 | - weather: Number, | ||
258 | - top: Array, | ||
259 | - bottom:Array | ||
260 | -}); | ||
261 | - | ||
262 | var Clothes = mongo.model('clothes', clothesSchema); | 261 | var Clothes = mongo.model('clothes', clothesSchema); |
263 | 262 | ||
264 | app.use(bodyParser.json()); | 263 | app.use(bodyParser.json()); | ... | ... |
-
Please register or login to post a comment