Showing
5 changed files
with
46 additions
and
29 deletions
1 | -const express = require('express'); | 1 | +const express = require('express'); |
2 | - | 2 | +const router = express.Router(); |
3 | -const router = express.Router(); | 3 | +const bodyParser = require('body-parser'); |
4 | - | 4 | + |
5 | - | 5 | + |
6 | - | 6 | +router.get('/data', function(req,res) { |
7 | -router.get('/', function(req,res) { | 7 | + return res.json({data:'myData'}); |
8 | - | 8 | +}); |
9 | - res.send({greeting: 'Hello React x Node.js'}); | 9 | + |
10 | - | 10 | + |
11 | -}); | 11 | + |
12 | - | ||
13 | - | ||
14 | - | ||
15 | module.exports = router; | 12 | module.exports = router; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -61,6 +61,15 @@ | ... | @@ -61,6 +61,15 @@ |
61 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", | 61 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", |
62 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" | 62 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" |
63 | }, | 63 | }, |
64 | + "cors": { | ||
65 | + "version": "2.8.5", | ||
66 | + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", | ||
67 | + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", | ||
68 | + "requires": { | ||
69 | + "object-assign": "^4", | ||
70 | + "vary": "^1" | ||
71 | + } | ||
72 | + }, | ||
64 | "debug": { | 73 | "debug": { |
65 | "version": "2.6.9", | 74 | "version": "2.6.9", |
66 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", | 75 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", |
... | @@ -233,6 +242,11 @@ | ... | @@ -233,6 +242,11 @@ |
233 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", | 242 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", |
234 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" | 243 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" |
235 | }, | 244 | }, |
245 | + "object-assign": { | ||
246 | + "version": "4.1.1", | ||
247 | + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", | ||
248 | + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" | ||
249 | + }, | ||
236 | "on-finished": { | 250 | "on-finished": { |
237 | "version": "2.3.0", | 251 | "version": "2.3.0", |
238 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", | 252 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", | ... | ... |
1 | - | 1 | + |
2 | -const express = require('express'); | 2 | +const express = require('express'); |
3 | -const app = express(); | 3 | +const app = express(); |
4 | -const api = require('./apiRouter'); | 4 | +const api = require('./apiRouter'); |
5 | - | 5 | +const cors = require('cors'); |
6 | -app.use('/api', api); | 6 | + |
7 | - | 7 | +app.use(cors()); |
8 | -const port = 3002; | 8 | +app.use('/api', api); |
9 | -app.listen(port, () => console.log(`노드서버 시작 : ${port}`)); | 9 | + |
10 | +const port = 3001; | ||
11 | +app.listen(port, () => console.log(`노드서버 시작 : ${port}`)); | ... | ... |
... | @@ -58,9 +58,6 @@ class Subject extends PureComponent { | ... | @@ -58,9 +58,6 @@ class Subject extends PureComponent { |
58 | </blockquote> | 58 | </blockquote> |
59 | 59 | ||
60 | <FormGroup style={{margin:'10px 0px 0px 0px'}}> | 60 | <FormGroup style={{margin:'10px 0px 0px 0px'}}> |
61 | - <Label md="3" className="text-md-right"> | ||
62 | - Image upload | ||
63 | - </Label> | ||
64 | <Col md="8"> | 61 | <Col md="8"> |
65 | <input | 62 | <input |
66 | accept="image/*" onChange={this.onChangeInputImage} | 63 | accept="image/*" onChange={this.onChangeInputImage} |
... | @@ -75,7 +72,7 @@ class Subject extends PureComponent { | ... | @@ -75,7 +72,7 @@ class Subject extends PureComponent { |
75 | src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTEiIGhlaWdodD0iMTQxIj48cmVjdCB3aWR0aD0iMTkxIiBoZWlnaHQ9IjE0MSIgZmlsbD0iI2VlZSIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9Ijk1LjUiIHk9IjcwLjUiIHN0eWxlPSJmaWxsOiNhYWE7Zm9udC13ZWlnaHQ6Ym9sZDtmb250LXNpemU6MTJweDtmb250LWZhbWlseTpBcmlhbCxIZWx2ZXRpY2Esc2Fucy1zZXJpZjtkb21pbmFudC1iYXNlbGluZTpjZW50cmFsIj4xOTF4MTQxPC90ZXh0Pjwvc3ZnPg==" | 72 | src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTEiIGhlaWdodD0iMTQxIj48cmVjdCB3aWR0aD0iMTkxIiBoZWlnaHQ9IjE0MSIgZmlsbD0iI2VlZSIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9Ijk1LjUiIHk9IjcwLjUiIHN0eWxlPSJmaWxsOiNhYWE7Zm9udC13ZWlnaHQ6Ym9sZDtmb250LXNpemU6MTJweDtmb250LWZhbWlseTpBcmlhbCxIZWx2ZXRpY2Esc2Fucy1zZXJpZjtkb21pbmFudC1iYXNlbGluZTpjZW50cmFsIj4xOTF4MTQxPC90ZXh0Pjwvc3ZnPg==" |
76 | />} | 73 | />} |
77 | <div> | 74 | <div> |
78 | - <Button type="button" color="default" onClick={this.onClickSaveImage} style={{margin:'10px 0px 0px 0px'}}>Select image</Button> | 75 | + <Button type="button" color="default" onClick={this.onClickSaveImage} style={{margin:'10px 0px 0px 0px'}}>Upload Image</Button> |
79 | </div> | 76 | </div> |
80 | </Col> | 77 | </Col> |
81 | </FormGroup> | 78 | </FormGroup> | ... | ... |
... | @@ -18,6 +18,7 @@ class Dashboard extends React.Component { | ... | @@ -18,6 +18,7 @@ class Dashboard extends React.Component { |
18 | this.onClickSaveVideo = this.onClickSaveVideo.bind(this); | 18 | this.onClickSaveVideo = this.onClickSaveVideo.bind(this); |
19 | this.state = { | 19 | this.state = { |
20 | videoFiles: [], | 20 | videoFiles: [], |
21 | + videoAnalysisResult:null | ||
21 | }; | 22 | }; |
22 | } | 23 | } |
23 | 24 | ||
... | @@ -39,10 +40,16 @@ class Dashboard extends React.Component { | ... | @@ -39,10 +40,16 @@ class Dashboard extends React.Component { |
39 | e.preventDefault(); | 40 | e.preventDefault(); |
40 | console.log(this.state.videoFiles); | 41 | console.log(this.state.videoFiles); |
41 | console.log("upload video"); | 42 | console.log("upload video"); |
43 | + // post request | ||
44 | + fetch('http://localhost:3001/api/data') | ||
45 | + .then(res=>res.json()) | ||
46 | + .then(data=>this.setState({videoAnalysisResult:data})) | ||
47 | + | ||
48 | + console.log(this.state.videoAnalysisResult); | ||
42 | this.setState({ | 49 | this.setState({ |
43 | videoFiles:[], | 50 | videoFiles:[], |
44 | }); | 51 | }); |
45 | - // post request | 52 | + |
46 | } | 53 | } |
47 | 54 | ||
48 | static propTypes = { | 55 | static propTypes = { |
... | @@ -68,7 +75,7 @@ class Dashboard extends React.Component { | ... | @@ -68,7 +75,7 @@ class Dashboard extends React.Component { |
68 | type="file" name="file" className="display-none" | 75 | type="file" name="file" className="display-none" |
69 | /> | 76 | /> |
70 | <div> | 77 | <div> |
71 | - <Button type="button" color="default" onClick={this.onClickSaveVideo} style={{margin:'10px 0px 0px 0px'}}>Select video</Button> | 78 | + <Button type="button" color="default" onClick={this.onClickSaveVideo} style={{margin:'10px 0px 0px 0px'}}>Analysis Video</Button> |
72 | </div> | 79 | </div> |
73 | </Col> | 80 | </Col> |
74 | </FormGroup> | 81 | </FormGroup> | ... | ... |
-
Please register or login to post a comment