Add function client/location.js to get user's location and send this to server
Showing
22 changed files
with
323 additions
and
86 deletions
... | @@ -12,6 +12,8 @@ | ... | @@ -12,6 +12,8 @@ |
12 | "@testing-library/react": "^11.1.0", | 12 | "@testing-library/react": "^11.1.0", |
13 | "@testing-library/user-event": "^12.1.10", | 13 | "@testing-library/user-event": "^12.1.10", |
14 | "axios": "^0.24.0", | 14 | "axios": "^0.24.0", |
15 | + "google-map-react": "^2.1.10", | ||
16 | + "google-maps-react": "^2.0.6", | ||
15 | "http-proxy-middleware": "^2.0.1", | 17 | "http-proxy-middleware": "^2.0.1", |
16 | "postcss-safe-parser": "^6.0.0", | 18 | "postcss-safe-parser": "^6.0.0", |
17 | "react": "^17.0.2", | 19 | "react": "^17.0.2", |
... | @@ -1515,6 +1517,14 @@ | ... | @@ -1515,6 +1517,14 @@ |
1515 | "url": "https://github.com/sponsors/sindresorhus" | 1517 | "url": "https://github.com/sponsors/sindresorhus" |
1516 | } | 1518 | } |
1517 | }, | 1519 | }, |
1520 | + "node_modules/@googlemaps/js-api-loader": { | ||
1521 | + "version": "1.12.11", | ||
1522 | + "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.12.11.tgz", | ||
1523 | + "integrity": "sha512-YdxC1uQhz8bgNlX7LgaDnF4VIaL/Q+72KzHKtDK/xlXkRmwpFuVCXLn22q/Lb5h4d4+NkFYD3cvtqxW6VpFp/w==", | ||
1524 | + "dependencies": { | ||
1525 | + "fast-deep-equal": "^3.1.3" | ||
1526 | + } | ||
1527 | + }, | ||
1518 | "node_modules/@hapi/address": { | 1528 | "node_modules/@hapi/address": { |
1519 | "version": "2.1.4", | 1529 | "version": "2.1.4", |
1520 | "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", | 1530 | "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", |
... | @@ -1830,6 +1840,11 @@ | ... | @@ -1830,6 +1840,11 @@ |
1830 | "node": ">= 10.14.2" | 1840 | "node": ">= 10.14.2" |
1831 | } | 1841 | } |
1832 | }, | 1842 | }, |
1843 | + "node_modules/@mapbox/point-geometry": { | ||
1844 | + "version": "0.1.0", | ||
1845 | + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", | ||
1846 | + "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=" | ||
1847 | + }, | ||
1833 | "node_modules/@nodelib/fs.scandir": { | 1848 | "node_modules/@nodelib/fs.scandir": { |
1834 | "version": "2.1.4", | 1849 | "version": "2.1.4", |
1835 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", | 1850 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", |
... | @@ -9239,9 +9254,9 @@ | ... | @@ -9239,9 +9254,9 @@ |
9239 | } | 9254 | } |
9240 | }, | 9255 | }, |
9241 | "node_modules/follow-redirects": { | 9256 | "node_modules/follow-redirects": { |
9242 | - "version": "1.14.5", | 9257 | + "version": "1.14.6", |
9243 | - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", | 9258 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", |
9244 | - "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==", | 9259 | + "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", |
9245 | "funding": [ | 9260 | "funding": [ |
9246 | { | 9261 | { |
9247 | "type": "individual", | 9262 | "type": "individual", |
... | @@ -9739,6 +9754,33 @@ | ... | @@ -9739,6 +9754,33 @@ |
9739 | "node": ">= 4" | 9754 | "node": ">= 4" |
9740 | } | 9755 | } |
9741 | }, | 9756 | }, |
9757 | + "node_modules/google-map-react": { | ||
9758 | + "version": "2.1.10", | ||
9759 | + "resolved": "https://registry.npmjs.org/google-map-react/-/google-map-react-2.1.10.tgz", | ||
9760 | + "integrity": "sha512-cqW2EcygYqF26inp5liM/pAcCwOGXB9LW32oGwf931Iuq8tnasCpyEtq87G+RyQCKCo2P8/QyV+MGHuc7r9AEg==", | ||
9761 | + "dependencies": { | ||
9762 | + "@googlemaps/js-api-loader": "^1.7.0", | ||
9763 | + "@mapbox/point-geometry": "^0.1.0", | ||
9764 | + "eventemitter3": "^4.0.4", | ||
9765 | + "prop-types": "^15.7.2" | ||
9766 | + }, | ||
9767 | + "engines": { | ||
9768 | + "node": ">=10" | ||
9769 | + }, | ||
9770 | + "peerDependencies": { | ||
9771 | + "react": "^16.0.0 || ^17.0.0", | ||
9772 | + "react-dom": "^16.0.0 || ^17.0.0" | ||
9773 | + } | ||
9774 | + }, | ||
9775 | + "node_modules/google-maps-react": { | ||
9776 | + "version": "2.0.6", | ||
9777 | + "resolved": "https://registry.npmjs.org/google-maps-react/-/google-maps-react-2.0.6.tgz", | ||
9778 | + "integrity": "sha512-M8Eo9WndfQEfxcmm6yRq03qdJgw1x6rQmJ9DN+a+xPQ3K7yNDGkVDbinrf4/8vcox7nELbeopbm4bpefKewWfQ==", | ||
9779 | + "peerDependencies": { | ||
9780 | + "react": "~0.14.8 || ^15.0.0 || ^16.0.0", | ||
9781 | + "react-dom": "~0.14.8 || ^15.0.0 || ^16.0.0" | ||
9782 | + } | ||
9783 | + }, | ||
9742 | "node_modules/graceful-fs": { | 9784 | "node_modules/graceful-fs": { |
9743 | "version": "4.2.6", | 9785 | "version": "4.2.6", |
9744 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", | 9786 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", |
... | @@ -23160,6 +23202,14 @@ | ... | @@ -23160,6 +23202,14 @@ |
23160 | } | 23202 | } |
23161 | } | 23203 | } |
23162 | }, | 23204 | }, |
23205 | + "@googlemaps/js-api-loader": { | ||
23206 | + "version": "1.12.11", | ||
23207 | + "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.12.11.tgz", | ||
23208 | + "integrity": "sha512-YdxC1uQhz8bgNlX7LgaDnF4VIaL/Q+72KzHKtDK/xlXkRmwpFuVCXLn22q/Lb5h4d4+NkFYD3cvtqxW6VpFp/w==", | ||
23209 | + "requires": { | ||
23210 | + "fast-deep-equal": "^3.1.3" | ||
23211 | + } | ||
23212 | + }, | ||
23163 | "@hapi/address": { | 23213 | "@hapi/address": { |
23164 | "version": "2.1.4", | 23214 | "version": "2.1.4", |
23165 | "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", | 23215 | "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", |
... | @@ -23409,6 +23459,11 @@ | ... | @@ -23409,6 +23459,11 @@ |
23409 | "chalk": "^4.0.0" | 23459 | "chalk": "^4.0.0" |
23410 | } | 23460 | } |
23411 | }, | 23461 | }, |
23462 | + "@mapbox/point-geometry": { | ||
23463 | + "version": "0.1.0", | ||
23464 | + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", | ||
23465 | + "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=" | ||
23466 | + }, | ||
23412 | "@nodelib/fs.scandir": { | 23467 | "@nodelib/fs.scandir": { |
23413 | "version": "2.1.4", | 23468 | "version": "2.1.4", |
23414 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", | 23469 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", |
... | @@ -28760,9 +28815,9 @@ | ... | @@ -28760,9 +28815,9 @@ |
28760 | } | 28815 | } |
28761 | }, | 28816 | }, |
28762 | "follow-redirects": { | 28817 | "follow-redirects": { |
28763 | - "version": "1.14.5", | 28818 | + "version": "1.14.6", |
28764 | - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", | 28819 | + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", |
28765 | - "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" | 28820 | + "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" |
28766 | }, | 28821 | }, |
28767 | "for-in": { | 28822 | "for-in": { |
28768 | "version": "1.0.2", | 28823 | "version": "1.0.2", |
... | @@ -29098,6 +29153,23 @@ | ... | @@ -29098,6 +29153,23 @@ |
29098 | } | 29153 | } |
29099 | } | 29154 | } |
29100 | }, | 29155 | }, |
29156 | + "google-map-react": { | ||
29157 | + "version": "2.1.10", | ||
29158 | + "resolved": "https://registry.npmjs.org/google-map-react/-/google-map-react-2.1.10.tgz", | ||
29159 | + "integrity": "sha512-cqW2EcygYqF26inp5liM/pAcCwOGXB9LW32oGwf931Iuq8tnasCpyEtq87G+RyQCKCo2P8/QyV+MGHuc7r9AEg==", | ||
29160 | + "requires": { | ||
29161 | + "@googlemaps/js-api-loader": "^1.7.0", | ||
29162 | + "@mapbox/point-geometry": "^0.1.0", | ||
29163 | + "eventemitter3": "^4.0.4", | ||
29164 | + "prop-types": "^15.7.2" | ||
29165 | + } | ||
29166 | + }, | ||
29167 | + "google-maps-react": { | ||
29168 | + "version": "2.0.6", | ||
29169 | + "resolved": "https://registry.npmjs.org/google-maps-react/-/google-maps-react-2.0.6.tgz", | ||
29170 | + "integrity": "sha512-M8Eo9WndfQEfxcmm6yRq03qdJgw1x6rQmJ9DN+a+xPQ3K7yNDGkVDbinrf4/8vcox7nELbeopbm4bpefKewWfQ==", | ||
29171 | + "requires": {} | ||
29172 | + }, | ||
29101 | "graceful-fs": { | 29173 | "graceful-fs": { |
29102 | "version": "4.2.6", | 29174 | "version": "4.2.6", |
29103 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", | 29175 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", | ... | ... |
... | @@ -7,6 +7,8 @@ | ... | @@ -7,6 +7,8 @@ |
7 | "@testing-library/react": "^11.1.0", | 7 | "@testing-library/react": "^11.1.0", |
8 | "@testing-library/user-event": "^12.1.10", | 8 | "@testing-library/user-event": "^12.1.10", |
9 | "axios": "^0.24.0", | 9 | "axios": "^0.24.0", |
10 | + "google-map-react": "^2.1.10", | ||
11 | + "google-maps-react": "^2.0.6", | ||
10 | "http-proxy-middleware": "^2.0.1", | 12 | "http-proxy-middleware": "^2.0.1", |
11 | "postcss-safe-parser": "^6.0.0", | 13 | "postcss-safe-parser": "^6.0.0", |
12 | "react": "^17.0.2", | 14 | "react": "^17.0.2", | ... | ... |
... | @@ -2,17 +2,6 @@ | ... | @@ -2,17 +2,6 @@ |
2 | text-align: center; | 2 | text-align: center; |
3 | } | 3 | } |
4 | 4 | ||
5 | -.App-logo { | ||
6 | - height: 40vmin; | ||
7 | - pointer-events: none; | ||
8 | -} | ||
9 | - | ||
10 | -@media (prefers-reduced-motion: no-preference) { | ||
11 | - .App-logo { | ||
12 | - animation: App-logo-spin infinite 20s linear; | ||
13 | - } | ||
14 | -} | ||
15 | - | ||
16 | .App-header { | 5 | .App-header { |
17 | background-color: #282c34; | 6 | background-color: #282c34; |
18 | min-height: 100vh; | 7 | min-height: 100vh; | ... | ... |
1 | -import axios from "axios"; | ||
2 | -import {useEffect} from "react"; | ||
3 | import './App.css'; | 1 | import './App.css'; |
2 | +import { useEffect} from "react"; | ||
3 | +import axios from 'axios'; | ||
4 | 4 | ||
5 | -function App() { | 5 | +function App(){ |
6 | - console.log("ang"); | ||
7 | - const callApi = async () => { | ||
8 | - axios.get("/test").then((res) => console.log(res.data.test)); | ||
9 | - }; | ||
10 | - | ||
11 | - useEffect(() => { | ||
12 | - callApi(); | ||
13 | - },); | ||
14 | 6 | ||
15 | - return (<div>test</div>); | 7 | +return <div> |
8 | +<title>Take an Umbrella</title> | ||
9 | +<h1> Take an Umbrella </h1> | ||
10 | +<h3> 철학과 2017101598 맹주환 </h3> | ||
11 | +<pre align="center"> | ||
12 | + 반가워요! | ||
13 | + Take an umbrella는 스마트 조명 제품 Philips hue API와 기상청 공공데이터 날씨 API로 구성되어 있어요. | ||
14 | + Hue가 연결된 WI-FI로 접속하셔서 아래의 지도로 현재 위치를 조회하시면, 해당 지역 기상 예보를 받아와 조명을 통해 우산을 챙겨야 하는지 알려줘요! | ||
15 | + </pre> | ||
16 | + </div>; | ||
16 | } | 17 | } |
17 | 18 | ||
18 | - | ||
19 | export default App; | 19 | export default App; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -3,10 +3,13 @@ import ReactDOM from 'react-dom'; | ... | @@ -3,10 +3,13 @@ import ReactDOM from 'react-dom'; |
3 | import './index.css'; | 3 | import './index.css'; |
4 | import App from './App'; | 4 | import App from './App'; |
5 | import reportWebVitals from './reportWebVitals'; | 5 | import reportWebVitals from './reportWebVitals'; |
6 | +import MapContainer from './map/index'; | ||
7 | +import Location from './map/location'; | ||
6 | 8 | ||
7 | ReactDOM.render( | 9 | ReactDOM.render( |
8 | <React.StrictMode> | 10 | <React.StrictMode> |
9 | <App /> | 11 | <App /> |
12 | + <Location /> | ||
10 | </React.StrictMode>, | 13 | </React.StrictMode>, |
11 | document.getElementById('root') | 14 | document.getElementById('root') |
12 | ); | 15 | ); | ... | ... |
client/src/map/index.js
0 → 100644
1 | +import React, { Component } from "react"; | ||
2 | +import { Map, GoogleApiWrapper, Marker } from 'google-maps-react'; | ||
3 | +import './style.css'; | ||
4 | + | ||
5 | +const mapStyles = { | ||
6 | + width: '600px', | ||
7 | + height: '600px', | ||
8 | +}; | ||
9 | + | ||
10 | +class Demo1 extends Component { | ||
11 | + constructor() { | ||
12 | + super(); | ||
13 | + this.state = { | ||
14 | + name: "React" | ||
15 | + }; | ||
16 | + } | ||
17 | + | ||
18 | + render() { | ||
19 | + return ( | ||
20 | + <div class="map"> | ||
21 | + <Map | ||
22 | + google={this.props.google} | ||
23 | + zoom={14} | ||
24 | + style={mapStyles} | ||
25 | + initialCenter={{ | ||
26 | + lat: '37.5905144', | ||
27 | + lng: '127.0576477' | ||
28 | + }} | ||
29 | + > | ||
30 | + <Marker | ||
31 | + onClick={this.onMarkerClick} | ||
32 | + /> | ||
33 | + </Map> | ||
34 | + </div> | ||
35 | + ); | ||
36 | + } | ||
37 | +} | ||
38 | + | ||
39 | +export default GoogleApiWrapper({ | ||
40 | + apiKey: 'AIzaSyAguo3zH8vWZJbzXEqyp8D8UvnBh3zX8rQ' | ||
41 | +})(Demo1); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/map/location.js
0 → 100644
1 | +import React, { Component } from "react"; | ||
2 | +import axios from 'axios'; | ||
3 | + | ||
4 | +class App extends Component { | ||
5 | + constructor(props) { | ||
6 | + super(props); | ||
7 | + this.state = { | ||
8 | + }; | ||
9 | + } | ||
10 | + | ||
11 | + render() { | ||
12 | + let data = { | ||
13 | + lat : null, | ||
14 | + lag : null | ||
15 | + }; | ||
16 | + navigator.geolocation.getCurrentPosition(function(position) { | ||
17 | + data = { | ||
18 | + lat : position.coords.latitude, | ||
19 | + lag : position.coords.longitude | ||
20 | + }; | ||
21 | + axios.post('/locate', JSON.stringify(data), { | ||
22 | + headers: { | ||
23 | + "Content-Type": `application/json`, | ||
24 | + }, | ||
25 | + }).then((res) => { | ||
26 | + console.log("complete"); | ||
27 | + }); | ||
28 | + }); | ||
29 | + return ( | ||
30 | + <div> | ||
31 | + </div> | ||
32 | + ); | ||
33 | + } | ||
34 | +} | ||
35 | +export default App; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
File moved
1 | /* Always set the map height explicitly to define the size of the div | 1 | /* Always set the map height explicitly to define the size of the div |
2 | * element that contains the map. */ | 2 | * element that contains the map. */ |
3 | - | 3 | + |
4 | - @import url(http://fonts.googleapis.com/earlyaccess/nanumgothic.css); | ||
5 | h1 { text-align: center; } | 4 | h1 { text-align: center; } |
6 | h2 { text-align: center; } | 5 | h2 { text-align: center; } |
7 | h3 { text-align: center; } | 6 | h3 { text-align: center; } | ... | ... |
... | @@ -2,10 +2,15 @@ const proxy = require('http-proxy-middleware'); | ... | @@ -2,10 +2,15 @@ const proxy = require('http-proxy-middleware'); |
2 | 2 | ||
3 | module.exports = function (app) { | 3 | module.exports = function (app) { |
4 | app.use( | 4 | app.use( |
5 | - proxy.createProxyMiddleware('/', { | 5 | + proxy.createProxyMiddleware('/api', { |
6 | - target: 'http://localhost:5000/', | 6 | + target: 'http://localhost:5000', |
7 | + changeOrigin : true | ||
8 | + }) | ||
9 | + ); | ||
10 | + app.use( | ||
11 | + proxy.createProxyMiddleware('/locate', { | ||
12 | + target: 'http://localhost:5000', | ||
7 | changeOrigin : true | 13 | changeOrigin : true |
8 | }) | 14 | }) |
9 | - | ||
10 | ); | 15 | ); |
11 | }; | 16 | }; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
client/src/user/user.js
0 → 100644
1 | +class App extends React.Component { | ||
2 | + state = { | ||
3 | + players: [ | ||
4 | + {name: 'LDK', score: 0, id: 1}, | ||
5 | + {name: 'HONG', score: 0, id: 2}, | ||
6 | + {name: 'KIM', score: 0, id: 3}, | ||
7 | + {name: 'PARK', score: 0, id: 4}, | ||
8 | + ] | ||
9 | + }; | ||
10 | + | ||
11 | + handleRemovePlayer = (id) => { | ||
12 | + this.setState(prevState => { | ||
13 | + return { | ||
14 | + players: prevState.players.filter(item => item.id !== id) | ||
15 | + } | ||
16 | + }) | ||
17 | + } | ||
18 | + | ||
19 | + render() { | ||
20 | + return ( | ||
21 | + <div className="container p-3"> | ||
22 | + <Header title="My scoreboard" totalPlayers={this.state.players.length} /> | ||
23 | + | ||
24 | + {/*Players List*/} | ||
25 | + { this.state.players.map(item => | ||
26 | + <Player key={item.id} | ||
27 | + name={item.name} score={item.score} | ||
28 | + removePlayer={this.handleRemovePlayer} id={item.id} />) } | ||
29 | + </div> | ||
30 | + ); | ||
31 | + } | ||
32 | + } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -1231,6 +1231,13 @@ | ... | @@ -1231,6 +1231,13 @@ |
1231 | "minimatch" "^3.0.4" | 1231 | "minimatch" "^3.0.4" |
1232 | "strip-json-comments" "^3.1.1" | 1232 | "strip-json-comments" "^3.1.1" |
1233 | 1233 | ||
1234 | +"@googlemaps/js-api-loader@^1.7.0": | ||
1235 | + "integrity" "sha512-YdxC1uQhz8bgNlX7LgaDnF4VIaL/Q+72KzHKtDK/xlXkRmwpFuVCXLn22q/Lb5h4d4+NkFYD3cvtqxW6VpFp/w==" | ||
1236 | + "resolved" "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.12.11.tgz" | ||
1237 | + "version" "1.12.11" | ||
1238 | + dependencies: | ||
1239 | + "fast-deep-equal" "^3.1.3" | ||
1240 | + | ||
1234 | "@hapi/address@2.x.x": | 1241 | "@hapi/address@2.x.x": |
1235 | "integrity" "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==" | 1242 | "integrity" "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==" |
1236 | "resolved" "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz" | 1243 | "resolved" "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz" |
... | @@ -1461,6 +1468,11 @@ | ... | @@ -1461,6 +1468,11 @@ |
1461 | "@types/yargs" "^16.0.0" | 1468 | "@types/yargs" "^16.0.0" |
1462 | "chalk" "^4.0.0" | 1469 | "chalk" "^4.0.0" |
1463 | 1470 | ||
1471 | +"@mapbox/point-geometry@^0.1.0": | ||
1472 | + "integrity" "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=" | ||
1473 | + "resolved" "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz" | ||
1474 | + "version" "0.1.0" | ||
1475 | + | ||
1464 | "@nodelib/fs.scandir@2.1.4": | 1476 | "@nodelib/fs.scandir@2.1.4": |
1465 | "integrity" "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==" | 1477 | "integrity" "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==" |
1466 | "resolved" "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz" | 1478 | "resolved" "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz" |
... | @@ -4869,7 +4881,7 @@ | ... | @@ -4869,7 +4881,7 @@ |
4869 | "resolved" "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" | 4881 | "resolved" "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" |
4870 | "version" "1.8.1" | 4882 | "version" "1.8.1" |
4871 | 4883 | ||
4872 | -"eventemitter3@^4.0.0": | 4884 | +"eventemitter3@^4.0.0", "eventemitter3@^4.0.4": |
4873 | "integrity" "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" | 4885 | "integrity" "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" |
4874 | "resolved" "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" | 4886 | "resolved" "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" |
4875 | "version" "4.0.7" | 4887 | "version" "4.0.7" |
... | @@ -5052,7 +5064,7 @@ | ... | @@ -5052,7 +5064,7 @@ |
5052 | "resolved" "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" | 5064 | "resolved" "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" |
5053 | "version" "1.3.0" | 5065 | "version" "1.3.0" |
5054 | 5066 | ||
5055 | -"fast-deep-equal@^3.1.1": | 5067 | +"fast-deep-equal@^3.1.1", "fast-deep-equal@^3.1.3": |
5056 | "integrity" "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" | 5068 | "integrity" "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" |
5057 | "resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" | 5069 | "resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" |
5058 | "version" "3.1.3" | 5070 | "version" "3.1.3" |
... | @@ -5234,9 +5246,9 @@ | ... | @@ -5234,9 +5246,9 @@ |
5234 | "readable-stream" "^2.3.6" | 5246 | "readable-stream" "^2.3.6" |
5235 | 5247 | ||
5236 | "follow-redirects@^1.0.0", "follow-redirects@^1.14.4": | 5248 | "follow-redirects@^1.0.0", "follow-redirects@^1.14.4": |
5237 | - "integrity" "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" | 5249 | + "integrity" "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" |
5238 | - "resolved" "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz" | 5250 | + "resolved" "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz" |
5239 | - "version" "1.14.5" | 5251 | + "version" "1.14.6" |
5240 | 5252 | ||
5241 | "for-in@^1.0.2": | 5253 | "for-in@^1.0.2": |
5242 | "integrity" "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" | 5254 | "integrity" "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" |
... | @@ -5513,6 +5525,21 @@ | ... | @@ -5513,6 +5525,21 @@ |
5513 | "merge2" "^1.3.0" | 5525 | "merge2" "^1.3.0" |
5514 | "slash" "^3.0.0" | 5526 | "slash" "^3.0.0" |
5515 | 5527 | ||
5528 | +"google-map-react@^2.1.10": | ||
5529 | + "integrity" "sha512-cqW2EcygYqF26inp5liM/pAcCwOGXB9LW32oGwf931Iuq8tnasCpyEtq87G+RyQCKCo2P8/QyV+MGHuc7r9AEg==" | ||
5530 | + "resolved" "https://registry.npmjs.org/google-map-react/-/google-map-react-2.1.10.tgz" | ||
5531 | + "version" "2.1.10" | ||
5532 | + dependencies: | ||
5533 | + "@googlemaps/js-api-loader" "^1.7.0" | ||
5534 | + "@mapbox/point-geometry" "^0.1.0" | ||
5535 | + "eventemitter3" "^4.0.4" | ||
5536 | + "prop-types" "^15.7.2" | ||
5537 | + | ||
5538 | +"google-maps-react@^2.0.6": | ||
5539 | + "integrity" "sha512-M8Eo9WndfQEfxcmm6yRq03qdJgw1x6rQmJ9DN+a+xPQ3K7yNDGkVDbinrf4/8vcox7nELbeopbm4bpefKewWfQ==" | ||
5540 | + "resolved" "https://registry.npmjs.org/google-maps-react/-/google-maps-react-2.0.6.tgz" | ||
5541 | + "version" "2.0.6" | ||
5542 | + | ||
5516 | "graceful-fs@^4.1.11", "graceful-fs@^4.1.15", "graceful-fs@^4.1.2", "graceful-fs@^4.1.6", "graceful-fs@^4.2.0", "graceful-fs@^4.2.4": | 5543 | "graceful-fs@^4.1.11", "graceful-fs@^4.1.15", "graceful-fs@^4.1.2", "graceful-fs@^4.1.6", "graceful-fs@^4.2.0", "graceful-fs@^4.2.4": |
5517 | "integrity" "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" | 5544 | "integrity" "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" |
5518 | "resolved" "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz" | 5545 | "resolved" "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz" |
... | @@ -9413,7 +9440,7 @@ | ... | @@ -9413,7 +9440,7 @@ |
9413 | "strip-ansi" "6.0.0" | 9440 | "strip-ansi" "6.0.0" |
9414 | "text-table" "0.2.0" | 9441 | "text-table" "0.2.0" |
9415 | 9442 | ||
9416 | -"react-dom@*", "react-dom@^17.0.2": | 9443 | +"react-dom@*", "react-dom@^16.0.0 || ^17.0.0", "react-dom@^17.0.2", "react-dom@~0.14.8 || ^15.0.0 || ^16.0.0": |
9417 | "integrity" "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==" | 9444 | "integrity" "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==" |
9418 | "resolved" "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz" | 9445 | "resolved" "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz" |
9419 | "version" "17.0.2" | 9446 | "version" "17.0.2" |
... | @@ -9508,7 +9535,7 @@ | ... | @@ -9508,7 +9535,7 @@ |
9508 | optionalDependencies: | 9535 | optionalDependencies: |
9509 | "fsevents" "^2.1.3" | 9536 | "fsevents" "^2.1.3" |
9510 | 9537 | ||
9511 | -"react@*", "react@^17.0.2", "react@>= 16", "react@17.0.2": | 9538 | +"react@*", "react@^16.0.0 || ^17.0.0", "react@^17.0.2", "react@>= 16", "react@~0.14.8 || ^15.0.0 || ^16.0.0", "react@17.0.2": |
9512 | "integrity" "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==" | 9539 | "integrity" "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==" |
9513 | "resolved" "https://registry.npmjs.org/react/-/react-17.0.2.tgz" | 9540 | "resolved" "https://registry.npmjs.org/react/-/react-17.0.2.tgz" |
9514 | "version" "17.0.2" | 9541 | "version" "17.0.2" | ... | ... |
html/index.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | - <head> | ||
4 | - <title>Take an Umbrella</title> | ||
5 | - <meta charset="UTF-8"> | ||
6 | - <link rel="stylesheet" type="text/css" href="style.css" /> | ||
7 | - </head> | ||
8 | - <body> | ||
9 | - <h1 style="font-family:Nanum Gothic;"> Take an Umbrella </h1> | ||
10 | - <h3 style="font-family:Nanum Gothic;"> 철학과 2017101598 맹주환 </h3> | ||
11 | - <pre align="center" style="font-family:Nanum Gothic;" font size="20"> | ||
12 | - 반가워요! | ||
13 | - Take an umbrella는 스마트 조명 제품 Philips hue API와 기상청 공공데이터 날씨 API로 구성되어 있어요. | ||
14 | - Hue가 연결된 WI-FI로 접속하셔서 아래의 지도로 현재 위치를 조회하시면, 해당 지역 기상 예보를 받아와 조명을 통해 우산을 챙겨야 하는지 알려줘요! | ||
15 | - </pre> | ||
16 | - <div id="map"></div> | ||
17 | - <!-- Async script executes immediately and must be after any DOM elements used in callback. --> | ||
18 | - | ||
19 | - <h1 style="font-family:Nanum Gothic;"> 당신의 현재 위치 </h1> | ||
20 | - <div align="center">현재 위도: <span id="lat"></span></div> | ||
21 | - <div align="center">현재 경도: <span id="lng"></span></div> | ||
22 | - </body> | ||
23 | - <script src="map.js"></script> | ||
24 | - <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script> | ||
25 | - <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAguo3zH8vWZJbzXEqyp8D8UvnBh3zX8rQ&callback=initMap&v=weekly" async> </script> | ||
26 | -</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
... | @@ -11,7 +11,9 @@ | ... | @@ -11,7 +11,9 @@ |
11 | "express": "^4.17.1", | 11 | "express": "^4.17.1", |
12 | "moment": "^2.29.1", | 12 | "moment": "^2.29.1", |
13 | "moment-timezone": "^0.5.34", | 13 | "moment-timezone": "^0.5.34", |
14 | + "node-hue-api": "^5.0.0-beta.8", | ||
14 | "nodemon": "^2.0.15", | 15 | "nodemon": "^2.0.15", |
15 | - "request": "^2.88.2" | 16 | + "request": "^2.88.2", |
17 | + "require": "^2.4.20" | ||
16 | } | 18 | } |
17 | } | 19 | } | ... | ... |
router/user.js
deleted
100644 → 0
1 | -const express = require("express"); | ||
2 | -const router = express.Router(); | ||
3 | - | ||
4 | -router.get("/", function (req, res, next) { | ||
5 | - res.json([ | ||
6 | - { id: 1, username: "VictorOladipo" }, | ||
7 | - { id: 2, username: "RussellWstbrook" }, | ||
8 | - ]); | ||
9 | -}); | ||
10 | - | ||
11 | -module.exports = router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
File moved
server/router/item.json
0 → 100644
1 | +[ | ||
2 | + { | ||
3 | + "GoodsCode": "1625717680", | ||
4 | + "OriginalPrice": "29,800", | ||
5 | + "SalePrice": "26,230", | ||
6 | + "GoodsName": "달콤나시(OBWC5266)(갤러리아)", | ||
7 | + "DiscountRate": "11", | ||
8 | + "Delivery": { | ||
9 | + "DeliveryInfo": "조건부무료", | ||
10 | + "DeliveryText": "배송비 3,000원", | ||
11 | + "DeliveryType": "GRAY", | ||
12 | + "ShowDeliveryInfo": true | ||
13 | + } | ||
14 | + }, | ||
15 | + { | ||
16 | + "GoodsCode": "1421117680", | ||
17 | + "OriginalPrice": "9,800", | ||
18 | + "SalePrice": "7,700", | ||
19 | + "GoodsName": "나시(현대)" | ||
20 | + } | ||
21 | +] | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
server/router/location.js
0 → 100644
1 | +const express = require('express'); | ||
2 | +const router = express.Router(); | ||
3 | + | ||
4 | +let location = new Array(); | ||
5 | + | ||
6 | +location = { | ||
7 | + lat : null, | ||
8 | + lng : null | ||
9 | +} | ||
10 | + | ||
11 | +router.post("/", (req,res) => { | ||
12 | + location.lat = req.body.lat; | ||
13 | + location.lng = req.body.lag; | ||
14 | + res.send({test : "hi"}); | ||
15 | +}); | ||
16 | + | ||
17 | +module.exports =router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
server/router/test.js
0 → 100644
1 | +const express = require('express'); | ||
2 | +const router = express.Router(); | ||
3 | + | ||
4 | +router.get("/", (req,res) => { | ||
5 | + res.send([ | ||
6 | + { | ||
7 | + "GoodsCode": "1625717680", | ||
8 | + "OriginalPrice": "29,800", | ||
9 | + "SalePrice": "26,230", | ||
10 | + "GoodsName": "달콤나시(OBWC5266)(갤러리아)", | ||
11 | + "DiscountRate": "11", | ||
12 | + "Delivery": { | ||
13 | + "DeliveryInfo": "조건부무료", | ||
14 | + "DeliveryText": "배송비 3,000원", | ||
15 | + "DeliveryType": "GRAY", | ||
16 | + "ShowDeliveryInfo": true | ||
17 | + } | ||
18 | + }, | ||
19 | + { | ||
20 | + "GoodsCode": "1421117680", | ||
21 | + "OriginalPrice": "9,800", | ||
22 | + "SalePrice": "7,700", | ||
23 | + "GoodsName": "나시(현대)" | ||
24 | + } | ||
25 | + ]); | ||
26 | +}); | ||
27 | + | ||
28 | +module.exports =router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
File moved
1 | const express = require('express'); | 1 | const express = require('express'); |
2 | const app = express(); | 2 | const app = express(); |
3 | const port = 5000; | 3 | const port = 5000; |
4 | -const test = require('../router/test'); | 4 | +const test = require('./router/test'); |
5 | -const weather = require('../router/Weather'); | 5 | +const weather = require('./router/Weather'); |
6 | -const user = require('../router/user'); | 6 | +const location = require('./router/location'); |
7 | const bodyParser = require('body-parser'); | 7 | const bodyParser = require('body-parser'); |
8 | const cors = require('cors'); | 8 | const cors = require('cors'); |
9 | 9 | ||
10 | +app.use(bodyParser.urlencoded({ extended: false })); | ||
11 | +app.use(bodyParser.json()); | ||
10 | app.use(cors()); | 12 | app.use(cors()); |
11 | -app.use("/test", test); | 13 | +app.use("/api", test); |
12 | app.use("/weather", weather); | 14 | app.use("/weather", weather); |
13 | -app.use("/user", user); | 15 | +app.use("/locate", location); |
14 | -app.use(bodyParser.json()); | ||
15 | 16 | ||
16 | 17 | ||
17 | 18 | ... | ... |
-
Please register or login to post a comment