How to use hyperquest - 10 common examples

To help you get started, we’ve selected a few hyperquest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digidem / mapeo-desktop / test / server.js View on Github external
var obs = {
      type: 'observation',
      lat: 0.4,
      lon: 1,
      attachments: [ {
        id: obj.id
      }]
    }

    hq.end(JSON.stringify(obs))
  }))

  hq.end()

  var hq2 = hyperquest.get(base + '/sync/announce', {})
  hq2.pipe(concat({ encoding: 'string' }, function (body) {
    console.log(body)
  }))
  hq2.end()
})
github ccarruitero / makemehapi / exercises / hello_hapi / exercise.js View on Github external
function verify (port, stream) {
    function error (err) {
      const msg = exercise.__('fail.cannot_connect', port, err.code);
      exercise.emit('fail', msg);
    }

    hyperquest.get(`http://localhost:${port}/`)
      .on('error', error)
      .pipe(bl((err, data) => {
        if (err) return stream.emit('error', err);

        stream.write(`${data.toString()}\n`);
        stream.end();
      }));
  }
github ccarruitero / makemehapi / exercises / routes / exercise.js View on Github external
function verify (port, stream) {
    function error (err) {
      const msg = exercise.__('fail.cannot_connect', port, err.code);
      exercise.emit('fail', msg);
    }

    hyperquest.get(`http://localhost:${port}/world`)
      .on('error', error)
      .pipe(bl((err, data) => {
        if (err) return stream.emit('error', err);

        stream.write(`${data.toString()}\n`);
        stream.end();
      }));
  }
github codio / tutorial_nodeschool_learnyounode / problems / http_json_api_server / setup.js View on Github external
.pipe(bl(function (err, data) {
      if (err)
        return output.emit('error', err)
      output.write(data.toString() + '\n')

      hyperquest.get('http://localhost:' + port + '/api/unixtime?iso=' + date.toISOString())
        .on('error', error)
        .pipe(bl(function (err, data) {
          if (err)
            return output.emit('error', err)

          output.write(data.toString() + '\n')
          output.end()
        }))

    }))
  return output
github lucasfcosta / learnyounode-pt-br / exercises / servidor_http_de_arquivos / exercise.js View on Github external
function connect (port, stream) {
    //TODO: introduce verification of content-type:text/plain and statusCode=200
    hyperquest.get('http://localhost:' + port)
      .on('error', function (err) {
        exercise.emit(
            'fail'
          , 'Error connecting to http://localhost:' + port + ': ' + err.message
        )
      })
      .pipe(stream)
  }
github ccarruitero / makemehapi / exercises / validation / exercise.js View on Github external
function verify (port, stream) {
    const url = `http://localhost:${port}/chickens`;

    function error (err) {
      const msg = exercise.__('fail.cannot_connect', port, err.code);
      exercise.emit('fail', msg);
    }

    hyperquest.get(url)
      .on('error', error)
      .pipe(bl((err, data) => {
        if (err) return stream.emit('error', err);

        stream.write(`${data.toString()}\n`);
        stream.end();
      }));
  }
github codio / tutorial_nodeschool_learnyounode / problems / http_file_server / setup.js View on Github external
setTimeout(function () {
    hyperquest.get('http://localhost:8000')
      .on('error', error.bind(null, 'http://localhost:8000', outputA))
      .pipe(outputA)
    if (!run) {
      hyperquest.get('http://localhost:8001')
        .on('error', error.bind(null, 'http://localhost:8001', outputB))
        .pipe(outputB)
    }
  }, 500)
github codio / tutorial_nodeschool_learnyounode / problems / http_file_server / setup.js View on Github external
setTimeout(function () {
    hyperquest.get('http://localhost:8000')
      .on('error', error.bind(null, 'http://localhost:8000', outputA))
      .pipe(outputA)
    if (!run) {
      hyperquest.get('http://localhost:8001')
        .on('error', error.bind(null, 'http://localhost:8001', outputB))
        .pipe(outputB)
    }
  }, 500)
github workshopper / learnyoureact / exercises / prop_and_state / exercise.js View on Github external
var doRequest = function () {
            hyperquest.get(url).pipe(bl(function (err, data) {
                if (err !== null) {
                    attempt++;
                    if (attempt < 100) {
                        setTimeout(doRequest, 100);
                    } else {
                        hyperquest.get(url).pipe(bl(onData));
                    }
                } else {
                    hyperquest.get(url).pipe(bl(onData));
                }
            }));
        };
github workshopper / learnyoureact / exercises / isomorphic / exercise.js View on Github external
var doRequest = function () {
            hyperquest.get(url).pipe(bl(function (err, data) {
                if (err !== null) {
                    attempt++;
                    if (attempt < 100) {
                        setTimeout(doRequest, 100);
                    } else {
                        hyperquest.get(url).pipe(bl(onData));
                    }
                } else {
                    hyperquest.get(url).pipe(bl(onData));
                }
            }));
        };

hyperquest

make streaming http requests

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis

Popular hyperquest functions