Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iarthstar/purescript-axios
Axios JS bindings for PureScript
https://github.com/iarthstar/purescript-axios
axios bindings javascript purescript rest-api wrapper
Last synced: 6 days ago
JSON representation
Axios JS bindings for PureScript
- Host: GitHub
- URL: https://github.com/iarthstar/purescript-axios
- Owner: iarthstar
- License: mit
- Created: 2019-08-05T22:00:54.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-13T04:43:52.000Z (about 3 years ago)
- Last Synced: 2024-11-10T10:54:33.794Z (10 days ago)
- Topics: axios, bindings, javascript, purescript, rest-api, wrapper
- Language: PureScript
- Homepage:
- Size: 32.2 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-axios
Axios JS bindings for PureScript
- [Module Documentation](https://pursuit.purescript.org/packages/purescript-axios/)
- [Example](https://github.com/iarthstar/purescript-axios/blob/master/test/Main.purs)## Add purescript-axios to your existing projects
```bash
bower i purescript-axios
```## Code Snippet
```purescript
newtype GetReleaseInfoReq = GetReleaseInfoReq
{ username :: String
, reponame :: String
}
derive instance genericGetReleaseInfoReq :: Generic GetReleaseInfoReq _
instance encodeGetReleaseInfoReq :: Encode GetReleaseInfoReq where
encode = genericEncode (defaultOptions { unwrapSingleConstructors = true })newtype GetReleaseInfoRes = GetReleaseInfoRes
{ total_download_count :: Int
}
derive instance genericGetReleaseInfoRes :: Generic GetReleaseInfoRes _
instance encodeGetReleaseInfoRes :: Decode GetReleaseInfoRes where
decode = genericDecode (defaultOptions { unwrapSingleConstructors = true })-- | Axios instance for GetReleaseInfo API
instance axiosGetReleaseInfo :: Axios GetReleaseInfoReq GetReleaseInfoRes where
axios = defaultAxios "https://grandeur-backend.herokuapp.com/gh_api/get_release_info/" POSTmain :: Effect Unit
main = launchAff_ do
let configPost = GetReleaseInfoReq { username : "iarthstar", reponame : "shadows-utilities" }
axios configPost >>= case _ of
Right (GetReleaseInfoRes a) -> log $ "POST ----> " <> show a.total_download_count
Left err -> logShow err
```## Development Guide
#### NOTE : Please make sure you have yarn :: [Installing yarn](https://yarnpkg.com/en/docs/install)
* Build Project
```bash
$ yarn install
$ yarn build
```* To Test
```bash
$ yarn test
```* To watch for changes
```bash
$ yarn start
```