Files
base-search/README.md
2025-08-17 20:55:38 +01:00

82 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Baseball Cards Search (eBay Sold Listings)
Search eBay completed (sold) listings for baseball cards by player name. Simple, fast UI: a single centered search box and a “Search Sold” button. Results show image, title, sold price, and end time, with a click-through to the listing on eBay.
## Features
- Player name search against eBay “Completed (Sold)” items
- Clean centered UI (input + button)
- Results grid with image, title, price, end time
- Click any result to open the eBay listing
## Tech Stack
- Backend: Node.js + Express
- Frontend: Vanilla HTML/CSS/JS (served statically)
- External API: eBay Finding API (`findCompletedItems`)
## Prerequisites
- Node.js 18+ recommended
- eBay App ID (aka Client ID) from the eBay Developers Program (Production keys)
## Setup
1. Install dependencies:
```bash
npm install
```
2. Configure environment:
- Copy `.env.example` to `.env` and set your App ID
```bash
cp .env.example .env
# then edit .env
EBAY_APP_ID=YOUR_EBAY_APP_ID_HERE
```
## Run
- Start the server:
```bash
npm start
```
- Open the app:
- http://localhost:3000
## Usage
1. Enter a player name (e.g., “Derek Jeter”) in the search box
2. Click “Search Sold” (or press Enter)
3. Browse results; click a card to open the listing on eBay
## API
- `GET /api/ebay/search?player=...&page=...`
- Query params:
- `player` (required): player name text
- `page` (optional): page number (default: 1)
- Response shape:
```json
{
"results": [
{
"title": "...",
"url": "https://www.ebay.com/itm/...",
"image": "https://...",
"price": "99.99",
"currency": "USD",
"ended": "2024-01-01T12:34:56.000Z"
}
]
}
```
## Project Structure
```
public/
index.html # UI
styles.css # styles (centered layout)
app.js # client logic
server.js # express server + eBay route
.env.example # environment template (copy to .env)
package.json
```
## Notes
- Ensure `EBAY_APP_ID` is set; otherwise `/api/ebay/search` returns 500.
- This app only surfaces limited listing metadata from eBays Finding API; you can expand it (conditions, set names, years, etc.) by refining keywords or adding item filters.
- For production usage, consider rate limiting, caching, and stricter keyword sanitization.