File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ func Run(config Config) {
64
64
}
65
65
// Indicate that what follows will be JSON
66
66
w .Header ().Add ("Content-Type" , "text/json" )
67
+ w .Header ().Add ("Access-Control-Allow-Origin" , "*" )
67
68
// Send it back!
68
69
w .Write (response )
69
70
})
Original file line number Diff line number Diff line change 1
1
function fetchImages ( ) {
2
- return Promise . resolve ( [
3
- {
4
- Title : "Sunset" ,
5
- AltText : "Clouds at sunset" ,
6
- URL : "https://images.unsplash.com/photo-1506815444479-bfdb1e96c566?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80" ,
7
- } ,
8
- {
9
- Title : "Mountain" ,
10
- AltText : "A mountain at sunset" ,
11
- URL : "https://images.unsplash.com/photo-1540979388789-6cee28a1cdc9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80" ,
12
- } ,
13
- ] ) ;
2
+ return fetch ( "http://localhost:8081/images.json" ) . then ( _ => _ . json ( ) )
14
3
}
15
4
16
5
function timeout ( t , v ) {
@@ -21,7 +10,7 @@ function fetchImages() {
21
10
22
11
const gallery$ = document . querySelector ( ".gallery" ) ;
23
12
24
- timeout ( 2000 , fetchImages ( ) ) . then ( images => {
13
+ fetchImages ( ) . then ( images => {
25
14
gallery$ . textContent = images . length ? "" : "No images available." ;
26
15
27
16
images . forEach ( img => {
You can’t perform that action at this time.
0 commit comments