1fetch('https://jsonplaceholder.typicode.com/posts', {
2 method: 'POST',
3 body: JSON.stringify({
4 title: 'foo',
5 body: 'bar',
6 userId: 1
7 }),
8 headers: {
9 'Content-type': 'application/json; charset=UTF-8'
10 }
11})
12.then(res => res.json())
13.then(console.log)
1fetch('https://jsonplaceholder.typicode.com/posts/1')
2 .then(res => res.json())
3 .then(console.log)