0.1.0 • Published 8 years ago
@yamadayuki/bs-axios v0.1.0
bs-axios
url module bindings for BuckleScript in Reason.
Installation
- Install
@yamadayuki/bs-axios
$ npm install --save @yamadayuki/bs-axios- Add
@yamadayuki/bs-axiostobs-dependenciessection 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 buildBuild + Watch
npm run startEditor
If you use vscode, Press Windows + Shift + B it will build automatically
0.1.0
8 years ago