#Technewsapi
TechNewsAPI is a Node.js application that scrapes the latest tech news articles from major news outlets including The Guardian, The New York Times, CNN, and BBC. It provides a RESTful API for accessing these articles.
- Fetches tech news articles from multiple sources.
- Provides a RESTful API to access the latest tech news.
- Utilizes Axios for making HTTP requests and Cheerio for parsing HTML.
- Clone the repository:
git clone https://github.com/faizabaig13/TechNewsAPI.git - Navigate to the project directory:
cd TechNewsAPI - Install the dependencies:
npm install
To start the application, run:
npm run startThe application will start, and you can access the API at http://localhost:8000.
- GET /tech-news/:source: Fetch tech news articles from a specific source (e.g.,
guardian,nyt,cnn,bbc). - GET /tech-news: Fetch all tech news articles from the supported sources.
Fetch all tech news articles:
curl http://localhost:8000/tech-newsFetch tech news articles from The Guardian:
curl http://localhost:8000/tech-news/guardianapp.js: The main application file containing the server and route definitions.routes/: Contains the route definitions for the API.services/: Contains the scraping logic for each news source.utils/: Contains utility functions for the project.
- Express: Fast, unopinionated, minimalist web framework for Node.js.
- Axios: Promise-based HTTP client for the browser and node.js.
- Cheerio: Fast, flexible, and lean implementation of core jQuery designed specifically for the server.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.