This project is a news web application built using React.js, Next.js, and the News API. It allows users to browse news articles from various sources and categories.
- Real-time News: Fetches and displays the latest news articles using the News API.
- Category-based Browsing: Allows users to filter news by categories (e.g., business, technology, sports).
- Source Filtering: Users can filter news by specific news sources.
- Search Functionality: Enables users to search for news articles based on keywords.
- Responsive Design: Provides a seamless experience across various devices.
- Server-Side Rendering (SSR): Implemented with Next.js for improved performance and SEO.
- Next.js API Routes: Utilizes Next.js API routes for efficient data fetching and handling.
- React.js: For building the user interface.
- Next.js: For server-side rendering and API routes.
- News API: For fetching news data.
- CSS/Styled-Components/Tailwind CSS: (Specify which you used) For styling.
- Axios/Fetch: (Specify which you used) For making API requests.
- dotenv: For managing environment variables.
-
Clone the repository:
git clone [repository-url] cd [project-directory] -
📦 Install dependencies:
npm install # or yarn install # or pnpm install
-
📂 Set up environment variables:
-
Create a
.env.localfile in the root directory. -
Add your News API key:
NEWS_API_KEY=your_news_api_key
-
-
🔗 Run the development server:
npm run dev # or yarn dev # or pnpm dev
-
Open your browser and navigate to
http://localhost:5000.
-
Build the application:
npm run build # or yarn build # or pnpm build
-
Start the production server:
npm run start # or yarn start # or pnpm start
/api/news: Fetches news articles based on query parameters (e.g., category, source, keyword).
Contributions are welcome! Please feel free to submit a pull request or open an issue.
MIT
[sammyifelse]