https://github.com/davidthorn/http-js
A javascript module which assist with making XMLHttpRequests
https://github.com/davidthorn/http-js
Last synced: about 1 year ago
JSON representation
A javascript module which assist with making XMLHttpRequests
- Host: GitHub
- URL: https://github.com/davidthorn/http-js
- Owner: davidthorn
- License: mit
- Created: 2018-11-25T00:59:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-25T04:03:52.000Z (over 7 years ago)
- Last Synced: 2025-01-31T14:47:47.239Z (over 1 year ago)
- Language: TypeScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Http JS
I wrote this library because I do not want to use jQuery or Angular for some simple tasks.
## Usage
Its usage is very simple and a lot like jQuery's http api.
## GET Request
```javascript
http.get({
url: 'https://jsonplaceholder.typicode.com/posts',
method: 'GET', // optional and implicit,
isJson: false, // only required if you want the response to be parse into JSON,
params: {} // Not required because I have not implemented the post api yet
}, (res, statusCode) => {
console.log('completed')
})
```
## JSON GET Request
```javascript
http.json({
url: 'https://jsonplaceholder.typicode.com/posts'
}, (json, statusCode) => {
console.log('completed json response' , json)
})
```