0.9.4 • Published 3 years ago

hippity v0.9.4

Weekly downloads
170
License
MIT
Repository
github
Last release
3 years ago

Hippity

Perform HTTP requests (preferably REST style!) from NodeJS or client-side javascript.

Features

  • Simple interface backed by middleware for complete flexibility
  • Promise based, with abort support
  • Automatic JSON serialization
  • Optional, automatic validation of server responses

Browser Support

ChromeFirefoxSafariOperaEdgeIE
Latest ✔Latest ✔Latest ✔Latest ✔Latest ✔11 ✔

Installing

Using npm:

$ npm install hippity

Until this project reaches a 1.0 release, breaking changes will be released with a new minor version. For example 0.5.1, and 0.5.4 will have the same API, but 0.6.0 will have breaking changes.

Examples

Perform a GET request. The following performs a GET to /api/search?term=foo%20bar, and throws an error if the response code is not "success" (between 200 and 300)

return await this.client.$get(['/api/search', { term: 'foo bar' }])

Perform a PUT request. The following performs a PUT to '/api/users/5' with JSON body of { "name": "John Smith" }.

It will throw an error only if their was an HTTP transport error (e.g. network disconnected). Otherwise it will return an enum (string) describing the result

async function example() {
  const response = await this.client.put(['/api/users/{id}', { id: 5 }], {
    name: 'John Smith',
  })

  // Could also check response.success !== false
  if (response.status === 201) {
    return 'Created'
  } else {
    return 'Unknown error'
  }
}

For more examples, please read the Wiki.

Report Issues

For any issues or feature requests, we would really appreciate it if you report them using our issue tracker.

Contributing

We are open to, and grateful for, any contributions made by the community. By contributing, you agree to abide by the code of conduct.

For more information, please check CONTRIBUTING.md

Licensing

Released under The MIT License. Copyright (c) berkeleybross.

Credits

Hippity is made possible by other open source software.

0.9.4

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.8.7

3 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago