Skip to content
Snippets Groups Projects
Commit e8ccb7d5 authored by Millicent Billette's avatar Millicent Billette
Browse files

WiP: network client

parent 7026c9c3
No related branches found
No related tags found
No related merge requests found
...@@ -73,12 +73,13 @@ ...@@ -73,12 +73,13 @@
}, },
"c8": { "c8": {
"all": true, "all": true,
"branches": 0.08, "branches": 0.8,
"lines": 0.08, "lines": 0.8,
"functions": 0.08, "functions": 0.8,
"statements": 0.08, "statements": 0.8,
"report-dir": "../coverage", "report-dir": "../coverage",
"temp-dir": "../nyc_output.temp", "temp-dir": "../nyc_output.temp",
"exclude": ["**.test*.*js"],
"reporter": [ "reporter": [
"text-summary", "text-summary",
"html" "html"
...@@ -103,7 +104,7 @@ ...@@ -103,7 +104,7 @@
"file": 50 "file": 50
}, },
"jscpd": { "jscpd": {
"threshold": 0.1, "threshold": 3.14,
"reporters": [ "reporters": [
"html", "html",
"console", "console",
......
import fetch from 'node-fetch'; import fetch from '../node_modules/node-fetch/lib/index.mjs';
export function DataPodClient(hosts){ export function DataPodClient(hosts) {
const self = this; const self = this;
self.hosts = hosts; self.hosts = hosts;
self.query = queryStr => query(self,queryStr) self.query = queryStr => query(self, queryStr);
return self; return self;
} }
async function query(self,queryStr){
return await (await fetch(self.hosts[0]+queryStr)).json(); async function query(self, queryStr) {
return await (await fetch(self.hosts[0] + queryStr)).json();
} }
import fetch from 'node-fetch'; import fetch from '../node_modules/node-fetch/lib/index.mjs';
export function GvaClient(hosts){ export function GvaClient(hosts) {
const self = this; const self = this;
self.hosts = hosts; self.hosts = hosts;
self.query = queryStr => query(self,queryStr) self.query = queryStr => query(self, queryStr);
return self; return self;
} }
async function query(self,queryStr){
return await (await fetch(self.hosts[0],{method: 'POST',body:queryStr})).json(); async function query(self, queryStr) {
return await (await fetch(self.hosts[0], {method: 'POST', body: queryStr})).json();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment