Merge branch 'feature/SearchingTheaters' into 'master'
Feature/searching theaters See merge request !34
Showing
5 changed files
with
77 additions
and
9 deletions
SearchingTheatersAPI/app.js
0 → 100644
| 1 | +const express = require("express"); | ||
| 2 | +const app = express(); | ||
| 3 | +const bodyParser = require('body-parser'); | ||
| 4 | +const request = require("request"); | ||
| 5 | +const router = express.Router(); | ||
| 6 | + | ||
| 7 | +let kakaoOptions = { | ||
| 8 | + url : "https://dapi.kakao.com/v2/local/search/keyword", | ||
| 9 | + method : "GET", | ||
| 10 | + headers : { | ||
| 11 | + 'Authorization': 'KakaoAK 56e51abe725086bc9db03da986e47fed' | ||
| 12 | + }, | ||
| 13 | + qs: { | ||
| 14 | + 'query': 'CGV 광명', | ||
| 15 | + //'category_group_code' : 'CT1', | ||
| 16 | + 'size' : 5 | ||
| 17 | + }, | ||
| 18 | + encoding : 'UTF-8' | ||
| 19 | +}; | ||
| 20 | + | ||
| 21 | +request(kakaoOptions, function (err, res, body) { | ||
| 22 | + info_list = JSON.parse(body).documents; | ||
| 23 | + let selectable_theaters = []; | ||
| 24 | + if(!err && res.statusCode == 200){ | ||
| 25 | + info_list.forEach(info => { | ||
| 26 | + if(info.category_name.endsWith("CGV")){ | ||
| 27 | + const theater_info = { | ||
| 28 | + "theater_name" : info.place_name, | ||
| 29 | + "theater_url" : info.place_url | ||
| 30 | + }; | ||
| 31 | + selectable_theaters.push(theater_info); | ||
| 32 | + //console.log(theater_info); | ||
| 33 | + } | ||
| 34 | + }); | ||
| 35 | + } | ||
| 36 | +}); | ||
| 37 | + | ||
| 38 | +module.exports = router; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
SearchingTheatersAPI/package.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "test01", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "", | ||
| 5 | + "main": "index.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "author": "", | ||
| 10 | + "license": "ISC", | ||
| 11 | + "dependencies": { | ||
| 12 | + "body-parser": "^1.17.1", | ||
| 13 | + "express": "^4.15.2", | ||
| 14 | + "express-session": "^1.15.2", | ||
| 15 | + "java": "^16.0.1", | ||
| 16 | + "request" : "^2.88.2" | ||
| 17 | + } | ||
| 18 | + } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
SearchingTheatersAPI/template.js
0 → 100644
| 1 | +module.exports= { | ||
| 2 | + html: function(title,style,list,body,control){ | ||
| 3 | + return ` | ||
| 4 | + <!doctype html> | ||
| 5 | + <html> | ||
| 6 | + <head> | ||
| 7 | + <title>WEB - ${title}</title> | ||
| 8 | + <meta charset="utf-8"> | ||
| 9 | + </head> | ||
| 10 | + <body> | ||
| 11 | + <h1><a href="/">WEB</a></h1> | ||
| 12 | + <div id="map" style=${style}></div> | ||
| 13 | + ${list} | ||
| 14 | + ${control} | ||
| 15 | + ${body} | ||
| 16 | + <p></p> | ||
| 17 | + </body> | ||
| 18 | + </html> | ||
| 19 | + `; | ||
| 20 | + } | ||
| 21 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
SearchingTheatersAPI/test.html
0 → 100644
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment