If fetch() feels weird, try the `ky` library—like fetch but with sane defaults.
For rest api request javascript, remember:
- Check response status first
- Parse JSON in a separate .then()
- Handle errors *always*
Example:
```javascript
const data = await ky.get('api-url').json();
```
Way cleaner than vanilla fetch!
For rest api request javascript, remember:
- Check response status first
- Parse JSON in a separate .then()
- Handle errors *always*
Example:
```javascript
const data = await ky.get('api-url').json();
```
Way cleaner than vanilla fetch!
