Advertisement
Guest User

fetch in console

a guest
Dec 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fetch('http://localhost:4000', {
  2.             headers: {
  3.                 'Content-Type': 'application/json',
  4.                 "Access-Control-Allow-Origin": "*"
  5.             },
  6.         })
  7.             .catch(err => console.log(err))
  8.             .then(data => data.json())
  9.             .then(json => console.log(json))
  10. /*
  11. Promise { <state>: "pending" }
  12. Object { content: "<h1>Hello World</h1>" }
  13. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement