-
-
Save amandeepmittal/d8391b9f5184fea0976f9b545998a7e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { API_KEY } from '../config/env'; | |
const url = `https://newsapi.org/v2/top-headlines?country=us&apiKey=${API_KEY}`; | |
export async function getUSANews() { | |
let result = await fetch(url).then((response = response.json())); | |
return result.articles; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment