iceflow-server
Advanced tools
Comparing version 0.0.8 to 0.1.0
@@ -106,7 +106,13 @@ 'use strict'; | ||
const action = !req.testMode ? require('../../../server/api/actions/' + frags[0] + '/get' + file) : require('../tests/stubs/action')(req.testMode); | ||
const requestData = { | ||
url: (specOptions.api ? conf.apis[specOptions.api] : '/api') + specOptions.action | ||
}; | ||
if(specOptions.data){ | ||
for(let n in specOptions.data){ | ||
requestData[n] = specOptions.data[n]; | ||
} | ||
} | ||
//create a synthetic for the action | ||
const request = SyntheticRequest({ | ||
url : (specOptions.api ? conf.apis[specOptions.api] : '/api') + specOptions.action, | ||
data: specOptions.data || {} | ||
}); | ||
const request = SyntheticRequest(requestData); | ||
//create the synthetic response, methods such as json() will resolve this promise | ||
@@ -191,3 +197,3 @@ const response = SyntheticResponse(); | ||
var request = superagent | ||
.get(action + (specOptions.data ? '?' + this.querify(specOptions.data) : '')) | ||
.get(action + (specOptions.data && specOptions.data.query ? '?' + this.querify(specOptions.data.query) : '')) | ||
@@ -194,0 +200,0 @@ if(specOptions.api){ |
@@ -30,3 +30,3 @@ 'use strict'; | ||
this.params = options.params || {}; | ||
this.query = this.getQueryData(options.data || location.search); | ||
this.query = this.getQueryData(options.query ? options.query : (typeof location !== 'undefined' ? location.search : null)); | ||
this.body = {}; | ||
@@ -33,0 +33,0 @@ |
{ | ||
"name": "iceflow-server", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -226,2 +226,23 @@ #Iceflow Server | ||
For params and query data the fetch method has a data key. Example: | ||
```javascript | ||
const HttpsService = require('iceflow-server/lib/HttpService'); | ||
HttpService.fetch({ | ||
users: { | ||
action: '/users/1', | ||
data: { | ||
params: { | ||
id: 1 | ||
}, | ||
query: { | ||
x: 2 | ||
} | ||
} | ||
} | ||
}).then( data => {}) | ||
``` | ||
- get/post/put/patch/delete (object) - Crud methods take an object in the form {url: '/', data: {}, cors: false} and returns a promise. | ||
@@ -228,0 +249,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45658
1050
344