All Projects → vaheqelyan → Karin

vaheqelyan / Karin

Licence: mit
An elegant promise based HTTP client for the browser and node.js [WIP]

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Karin

direwolf
Package direwolf is a convenient and easy to use http client written in Golang.
Stars: ✭ 44 (-88.8%)
Mutual labels:  http-client, http-requests
requester
The package provides a very thin wrapper (no external dependencies) for http.Client allowing the use of layers (middleware).
Stars: ✭ 14 (-96.44%)
Mutual labels:  http-client, http-requests
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (-87.79%)
Mutual labels:  http-client, http-requests
Frequest
FRequest - A fast, lightweight and opensource desktop application to make HTTP(s) requests
Stars: ✭ 130 (-66.92%)
Mutual labels:  http-client, http-requests
EthernetWebServer
This is simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and…
Stars: ✭ 118 (-69.97%)
Mutual labels:  http-client, http-requests
EthernetWebServer SSL
Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports …
Stars: ✭ 40 (-89.82%)
Mutual labels:  http-client, http-requests
swish
C++ HTTP requests for humans
Stars: ✭ 52 (-86.77%)
Mutual labels:  http-client, http-requests
Httpu
The terminal-first http client
Stars: ✭ 619 (+57.51%)
Mutual labels:  http-client, http-requests
Redes
High-level network layer abstraction library written in Swift.
Stars: ✭ 16 (-95.93%)
Mutual labels:  http-client, http-requests
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (-91.86%)
Mutual labels:  http-client, http-requests
Easygo
基于Kotlin、OkHttp的声明式网络框架,像写HTML界面一样写网络调用代码
Stars: ✭ 40 (-89.82%)
Mutual labels:  http-client, http-requests
Node Request Retry
💂 Wrap NodeJS request module to retry http requests in case of errors
Stars: ✭ 330 (-16.03%)
Mutual labels:  http-client, http-requests
Gout
gout to become the Swiss Army Knife of the http client @^^@---> gout 是http client领域的瑞士军刀,小巧,强大,犀利。具体用法可看文档,如使用迷惑或者API用得不爽都可提issues
Stars: ✭ 749 (+90.59%)
Mutual labels:  http-client, http-requests
pawn-requests
pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Stars: ✭ 56 (-85.75%)
Mutual labels:  http-client, http-requests
Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (+71.76%)
Mutual labels:  http-client, http-requests
relay
Relay lets you write HTTP requests as easy to read, structured YAML and dispatch them easily using a CLI. Similar to tools like Postman
Stars: ✭ 22 (-94.4%)
Mutual labels:  http-client, http-requests
Ky Universal
Use Ky in both Node.js and browsers
Stars: ✭ 421 (+7.12%)
Mutual labels:  http-client, browser
Requests
Convenient http client for java, inspired by python request module
Stars: ✭ 459 (+16.79%)
Mutual labels:  http-client, http-requests
centra
Core Node.js HTTP client
Stars: ✭ 52 (-86.77%)
Mutual labels:  http-client, http-requests
robotframework-httprequestlibrary
Robot Framework's library to test REST interfaces utilizing Apache HttpClient
Stars: ✭ 20 (-94.91%)
Mutual labels:  http-client, http-requests

Karin

About

Template literals are very useful. A more advanced form of template literals are tagged templates. Karin works in all major browsers (Chrome, Firefox, IE, Edge, Safari, and Opera). Modern browsers and JavaScript engines support tag templates. It is also compatible with Node.js. The package uses the Fetch API, make sure you have a polyfill to support older browsers. Recommend to use github/fetch

e.g.

import React from "react";
import { get } from "karin";

export default class Index extends React.Component {
  static async getInitialProps() {
    const { data, response } = await get`https://api.github.com/repos/zeit/next.js`;
    return { stars: data.stargazers_count };
  }

  render() {
    return (
      <div>
        <p> {this.props.stars} ⭐️</p>
      </div>
    );
  }
}

Installation

via NPM

npm i karin

via CDN (unpkg)

https://unpkg.com/[email protected]/build/browser/index.umd.js

UMD library exposed as Karin

const { get, post } = Karin;

Import paths

import { get, post } from "karin/build/node";
import { get, post } from "karin/build/browser/index.umd.js";

Make a get request

The response data - By default, if the response data type is Application/JSON, the response will be parsed into JSON

import { get } from "karin";

get`https://api.github.com/repos/vaheqelyan/karin`
  .then(result => console.log(result))
  .catch(err => console.error(err));

Make a post request

The post data - If the data is an object, it will be stringified

The response data - By default, if the response data type is application/json, the response will be parsed into JSON

Note that the data to be sent is the last item.

import { post } from "karin";

const user = {
  username: "vaheqelyan",
  password: "XXXX"
};

post`http://localhost:3000/register ${user}`
  .then(result => console.log(result))
  .catch(err => console.log(err));

Add Header in HTTP Request

post`https://example.com/api.createMsg?${{apiKey: config.apiKey}}
Content-Type: application/json
Accept: application/json
XXX: xxx

${{
  title: 'Test Message',
  body: 'This is a test of the messaging system.'
}}`

Thanks to Ken Bellows for the idea.

See Version 0.11.1 for old syntax

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].