@yamadayuki/bs-axios
v0.1.0
Published
axios bindings for ReasonML
Downloads
3
Readme
bs-axios
url
module bindings for BuckleScript in Reason.
Installation
- Install
@yamadayuki/bs-axios
$ npm install --save @yamadayuki/bs-axios
- Add
@yamadayuki/bs-axios
tobs-dependencies
section ofbsconfig.json
.
Usage
Perfoming a GET
request
open Js.Promise;
Axios.get("/users?id=12345")
|> then_(res => resolve(Js.log(res##data)))
|> catch(err => resolve(Js.log(err)))
/* With config for authentication */
Axios.getWithConfig("/users?id=12345", Axios.makeConfig(~auth={"username": "foo", "password": "bar"}, ()))
|> then_(res => resolve(Js.log(res##data)))
|> catch(err => resolve(Js.log(err)))
Performing a POST
request
open Js.Promise;
postData("/users", {"firstName": "Fred", "lastName": "Flintstone"})
|> then_(res => resolve(Js.log(res##data)))
|> catch(err => resolve(Js.log(err)))
TODO
- Support
axios.spread
- Consider Interceptors
Contributing
Build
npm run build
Build + Watch
npm run start
Editor
If you use vscode
, Press Windows + Shift + B
it will build automatically