This package has been deprecated

Author message:

older

tohttp

1.4.5 • Public • Published

toHttp

npm version Bower version


English

tohttp is a module for HTTP requests from HTTPS, either from the client side (in the browser) or server side (with nodejs).

Also it works for anonymous requests because the requests are made by a remote server with https security.

Your traffic is safe, nothing is stored on another server

Español

toHttp es un módulo para realizar peticiones HTTP desde HTTPS, ya sea desde el lado del cliente (en el navegador) o del lado del servidor (con nodejs).

Tambien funciona para realizar peticiones anonimas, ya que las peticiones son efectuadas por un servidor remoto con seguridad https.

Tu trafico es seguro, nada es almacenado en otro servidor.

Installation

npm

npm install tohttp --save

Quick Example

Node

import tohttp from 'tohttp'; //ES6
//Or
var tohttp = require('tohttp'); //Node normal
//GET
tohttp.get('http://www.example.com', function (result) { //Dir web, IP ...
  console.log(result);
});
 
//POST
tohttp.post('http://www.example.com', { //Dir web, IP ...
    email: 'mail@mail.com'
}, function(result) {
    console.log(result);
});
 
//PUT
tohttp.put('http://www.example.com', { //Dir web, IP ...
    email: 'mail@mail.com',
    pass: 'xxxxxx'
}, function(result) {
    console.log(result);
});

Also request HEAD and DELETE.

Browser

Use RequireJS o WebPack.

Example

Code in the server or browser:

tohttp.get('http://example.com', function (result) {
  console.log(result);
});

Output in format JSON:

{
  "code": 200,
  "headers":
   {
     "server": "Cowboy",
     "connection": "close",
     "x-powered-by": "Express",
     "content-type": "application/json; charset=utf-8",
     "content-length": 12185,
     "etag": "W/'2f99-476I792nSGQcjm7FwiGErg'",
     "date": "Tue, 05 Jul 2016 23:07:13 GMT",
     "via": "1.1 vegur"
   },
  "body": {
     //Here your code: html, json, text...
  }

Credits

Full credit to anlijudavid

Package Sidebar

Install

npm i tohttp

Weekly Downloads

0

Version

1.4.5

License

ISC

Last publish

Collaborators

  • anlijudavid