• R/O
  • HTTP
  • SSH
  • HTTPS

zephyr: Commit

This repository is for zephyr, which is implemented for a GUI of Eos.


Commit MetaInfo

Revision5a23a44054fae3ec88abaafe670a2c71859f0167 (tree)
Time2016-01-27 02:58:23
Authorhimetani_cafe <fumifumi@yasu...>
Commiterhimetani_cafe

Log Message

[INSTALL] request module which is simplified HTTP client

wrote a simple program to send POST for /api/v1/execution
On branch master
Changes to be committed:

modified: package.json

modified: server/api/v1/execution/index.js

modified: test/rest/execution.test.js

Change Summary

Incremental Difference

--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
2121 "express": "^4.13.3",
2222 "formidable": "^1.0.17",
2323 "node-uuid": "^1.4.7",
24+ "request": "^2.67.0",
2425 "sequelize": "^3.18.0",
2526 "socket.io": "^1.3.7",
2627 "sqlite3": "^3.1.1"
--- a/server/api/v1/execution/index.js
+++ b/server/api/v1/execution/index.js
@@ -5,10 +5,11 @@ var router = express.Router()
55 var path = require('path')
66 var formidable = require('formidable')
77 var db = require(__dirname + '/../../../../server/class/DB').instance;
8+var eos = require(__dirname + '/../../../../server/class/Eos').instance;
89
910 router.post('/', function(req, res) {
1011 console.log(req.body);
11- res.send(req.body);
12+ res.send('/api/v1/execution');
1213 });
1314
1415 module.exports = router;
--- a/test/rest/execution.test.js
+++ b/test/rest/execution.test.js
@@ -1,3 +1,21 @@
11 'use strict';
22
3+var request = require('request');
34
5+request({
6+ method: 'POST',
7+ uri: 'http://localhost:3000/api/v1/execution',
8+ multipart: [
9+ {
10+ 'content-type': 'application/json',
11+ body: JSON.stringify({foo: 'bar', greeting: 'hello'})
12+ },
13+ { body: 'I am an attachment' }
14+ ],
15+},
16+function(error, resopnse, body) {
17+ if(error) {
18+ return console.error('upload failed:', error);
19+ }
20+ console.log(body);
21+});
Show on old repository browser