mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
17 lines
324 B
JavaScript
17 lines
324 B
JavaScript
import fetch from 'fetch'
|
|
|
|
const URL = 'https://example.com'
|
|
const PORT = 8080
|
|
|
|
/// [demo]
|
|
const result = fetch(`${URL}:${PORT}`)
|
|
.then(function(response) {
|
|
return response.json();
|
|
})
|
|
.then(function(myJson) {
|
|
console.log(JSON.stringify(myJson));
|
|
});
|
|
/// [demo]
|
|
|
|
result.then(console.log).catch(console.error)
|