Skip to content

Commit eea34cf

Browse files
authored
Create example.js
1 parent 05f683b commit eea34cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

_media/example.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import fetch from 'fetch';
2+
3+
const URL = 'https://example.com';
4+
const PORT = 8080;
5+
6+
/// [demo]
7+
const result = fetch(`${URL}:${PORT}`)
8+
.then(response => {
9+
return response.json();
10+
})
11+
.then(myJson => {
12+
console.log(JSON.stringify(myJson));
13+
});
14+
/// [demo]
15+
16+
result.then(console.log).catch(console.error);

0 commit comments

Comments
 (0)