Methods

With hyttpo you don't have to send only GET request, but also others.

All supported methods:

  • GET
  • POST
  • PATCH
  • PUT
  • TRACE
  • HEAD
  • OPTIONS
  • CONNECT
  • DELETE
  • SEARCH

Example code

const hyttpo = require('hyttpo').default;

hyttpo.request({
    method: 'GET',
    url: 'https://api.ipify.org/?format=json'
})
    .catch(e => e)
    .then(res => {
        console.log(res.data)
    })
1
2
3
4
5
6
7
8
9
10
const hyttpo = require('hyttpo').default;

hyttpo.request({
    method: 'POST',
    url: 'url',
    body: JSON.stringify({
        data: 'omg'
    })
})
    .catch(e => e)
    .then(res => {
        console.log(res.data)
    })
1
2
3
4
5
6
7
8
9
10
11
12
13

Learn

All of these methods serve a purpose, but GET and POST are quite sufficient to get you started. You can read more about the methods hereopen in new window