https://github.com/sagnik-coder24/api-basics
Reddit API basics
https://github.com/sagnik-coder24/api-basics
api axios basic-learning reactjs reddit-api superagent vite
Last synced: 2 months ago
JSON representation
Reddit API basics
- Host: GitHub
- URL: https://github.com/sagnik-coder24/api-basics
- Owner: Sagnik-Coder24
- Created: 2024-10-23T18:34:14.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-10-23T20:23:45.000Z (12 months ago)
- Last Synced: 2025-04-06T06:46:08.471Z (6 months ago)
- Topics: api, axios, basic-learning, reactjs, reddit-api, superagent, vite
- Language: JavaScript
- Homepage: https://sagnik-coder24.github.io/api-basics/
- Size: 199 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reddit API Search App
A simple React application using Vite that allows users to search for subreddits and fetch posts from Reddit's API. Users can choose between Axios or Superagent to make API calls.
## Features
- Search for any subreddit
- Fetch data from Reddit API
- Display a list of posts with clickable links
- Option to use either Axios or Superagent for API requests## Built With
- [**React**](https://reactjs.org/) - A JavaScript library for building user interfaces
- [**Vite**](https://vitejs.dev/) - Next Generation Frontend Tooling
- [**Axios**](https://axios-http.com/) - Promise-based HTTP client for the browser and Node.js
- [**Superagent**](https://visionmedia.github.io/superagent/) - Small progressive client-side HTTP request library
- [**Reddit API**](https://www.reddit.com/dev/api/) - Official API provided by Reddit for fetching subreddit data## Getting Started
### Prerequisites
Make sure you have [Node.js](https://nodejs.org/) installed on your machine.
### Installation
1. Clone the repository:
```bash
git clone https://github.com/Sagnik-Coder24/api-basics.git
cd api-basics```
2. Install dependencies:
```bash
npm install
```## Usage
1. Start the development server:
```bash
npm run dev```
2. Open your browser and navigate to [http://localhost:5173](http://localhost:5173).
3. Use the search input to enter a subreddit name and fetch posts.
## Switching between Axios and Superagent
In the app's settings, you can toggle between using Axios and Superagent for making API calls. This will allow you to see how each library handles requests and responses.
## API Reference
The application fetches data from the following endpoint:
- https://www.reddit.com/r/{subreddit}.json
Replace `{subreddit}` with the name of the subreddit you want to search.
## Example Usage
1. Enter a subreddit name (e.g., `reactjs`) in the search input.
2. Click the search button to fetch posts.
3. A list of posts will be displayed, each linking to the respective Reddit post page.## Contributing
Feel free to submit issues or pull requests. Contributions are welcome!
## Acknowledgments
- [Reddit API](https://www.reddit.com/dev/api/) - For providing the data
- [React](https://reactjs.org/) - For making UI development simple and efficient
- [Vite](https://vitejs.dev/) - For the modern build tool