Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Falah Al Fitri
Falah Al Fitri

Posted on

     

API newsapi.org | Express | for beginner

package.json

{..."dependencies":{"express":"^4.17.1","newsapi":"^2.4.1"}}
Enter fullscreen modeExit fullscreen mode

index.js

/* require newsapi */constNewsAPI=require('newsapi');constnewsapi=newNewsAPI('YOUR-API-KEY');/* require express */constexpress=require('express')constapp=express()app.get("/",function(req,res){// To query sources// All options are optionalnewsapi.v2.sources().then(response=>{console.log(response.sources)})})app.listen(4000)
Enter fullscreen modeExit fullscreen mode

References

npmjs.com/package/newsapi
npmjs.com/package/express

newsapi.org

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
newsdataio profile image
Vineet Prasad
Newsdataio provides free access to news API that developers can use. The API provides real-time breaking news and historical news. NewsData.io API is the best alternative for Google News API.
  • Location
    India
  • Joined

Hi there! I noticed that you're using Newsapi.org for your news data. Have you considered usingNewsData.io news API? I've found it to be really comprehensive and easy to use. It might be worth checking out as an alternative for your news data needs. Good luck with your project

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I am Developer
  • Location
    Marabahan, Indonesia
  • Education
    S. Kom of UNISKA Banjarmasin
  • Work
    Toy Seller
  • Joined

More fromFalah Al Fitri

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp