Giter Club home page Giter Club logo

fetch's Introduction

Fetch

PRs Welcome

Fetch libraries and interface for ReasonML/OCaml.

Fetch aims to provide a common interface over different HTTP and Promise-implementations in the ReasonML/OCaml ecosystem.

A note is that Fetch is still in a phase where we're figuring out the API. In other words, the API may change and input is welcome!

Provides a functor for creating and providing your own Fetch-implementation. The goal is to be pluggable with any HTTP or Promise-implementation provided it conforms to the common interface.

Windows macOS Ubuntu

A consumable fetch-library for ReasonML/OCaml native. Uses Lwt for its Promise-implementation.

To install, add the library to your esy-manifest, like so:

{
  "dependencies": {
    "fetch-native-lwt": "lessp/fetch:fetch-native-lwt.json"
  }
}

or, to point to a specific commit:

"fetch-native-lwt": "lessp/fetch:fetch-native-lwt.json#<commit-hash>"

Contributing

Feel free to open an issue and/or grabbing one of the open issues.

Contributors

Tom Ekander
Tom Ekander

๐Ÿ’ป ๐Ÿค” ๐Ÿ“–
Et7f3
Et7f3

๐Ÿ’ป ๐Ÿค” ๐Ÿ‘€
Ulrik Strid
Ulrik Strid

๐Ÿ’ป ๐Ÿค” ๐Ÿ‘€
Leandro Ostera
Leandro Ostera

๐Ÿค”

This project follows the all-contributors specification. Contributions of any kind welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details

fetch's People

Contributors

et7f3 avatar lessp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dangdennis

fetch's Issues

Approachable by OCamlers

There are different idioms in ReasonML and OCaml, camelCase vs snake_case and PascalCase vs Giraffe_case meaning that there'd be some friction if someone would like to use this in the OCaml world.

We can provide aliases, similar to what Tablecloth are doing, but that still leaves us with the status-codes being PascalCase'd.

Could also provide a separate library

Provide "sensible defaults"

An idea is to provide good default libraries, a part from offering the interface.

It'd be nice if this could include support for HTTPS and HTTP2 as well!

Something like:

fetch-native-lwt
fetch-native-repromise

fetch-node-future
fetch-node-repromise

Fetch Native

  • fetch-native-lwt (HTTP/HTTPS)
  • fetch-native-repromise (HTTP/HTTPS)

Fetch Node

  • fetch-node-future (HTTP/HTTPS)
  • fetch-node-repromise (HTTP/HTTPS)

Make it possible to extend a Fetch-implementation

One issue I see currently is that there's no way to extend the current Fetch-implementation.

E.g. it'd be nice for consumers to extend with custom functionality:

module Body: {
   ...
   let toJSON = ... => ...
}

Cancelling a request

May be something for further down the road (or not at all), but logging to remember it!

both fetch and e.g. axios use a similar API. Seeing as reason-fetch bases many of its decisions from whatwg, it might be an idea to go with a similar API (AbortSignal) to that.

Separate libraries (and their dependencies)

As raised by @anmonteiro and @ulrikstrid, the should at least split its dependencies:

@anmonteiro

I might be a minority here, but a suggestion I'd make is to get rid of (most) dependencies
personally I'm very careful in what (transitive) dependencies I depend on
and I don't think I'd use a library that brings in reason as a dependency, or a "core" library like tablecloth

@ulrikstrid

The core fetch library should probably not have any dependencies and then there should be implementations that have dependencies

Make the return type of `fetch` transparent

Currently the return type is not transparent. I think this should be possible by using destructive substitution, but I'm not sure how!

From:

(
  ~body: option(string), 
  ~headers: option(list(Fetch.Headers.t)), 
  ~meth: option(Fetch.Method.t), 
  string, 
  unit
) => Fetch.IO.t;

To:

(
  ~body: option(string), 
  ~headers: option(list(Fetch.Headers.t)), 
  ~meth: option(Fetch.Method.t), 
  string, 
  unit
) => Promise.t(result(Response.t, exn));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.