Skip to content

Commit 1d9a6a9

Browse files
APOD API Returning Results
1 parent 6f8d071 commit 1d9a6a9

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

.github/assets/celestial-bodies.png

-4.53 KB
Loading

index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ const parameters = {
1010

1111
http.createServer(function (req, res) {
1212
const apiCall = api.apod(parameters, function(response) {
13-
return response;
13+
console.log(response);
1414
});
15-
console.log(apiCall)
1615
res.writeHead(200, {'Content-Type': 'text/html'});
1716
}).listen(port, () => {console.log(`Celestial Bodies is listening at http://localhost:${port}`)});

lib/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ function apod(params, callback) {
1414
const request = 'https://api.nasa.gov/planetary/apod?api_key=' + params.key + '&date=' + params.date + '&hd=' + params.hd;
1515
return axios(request)
1616
.then((response) => {
17-
callback(response);
17+
callback(response.data);
1818
})
1919
.catch(function (error) {
20-
console.log('error');
20+
return error;
2121
})
2222
.then(function () {
23-
23+
return;
2424
});
2525
};
2626

0 commit comments

Comments
 (0)