Last active
April 19, 2019 03:11
-
-
Save pinkhominid/28f045452c34211b488e13aee35f9dd9 to your computer and use it in GitHub Desktop.
Fetch in console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('/api/things') | |
.then(res => res.json()) | |
.then(res => console.log(res)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, technically that is 3 lines, but only for readability. Here it is one-true-line..
fetch('/api/things').then(res => res.json()).then(res => console.log(res))