# packages/api-server ## Scope - This package is the HTTP transport layer over `@marketplace-scrapers/core`. - Route files in `src/routes/*.ts` should parse inputs, call core, and map responses/errors. ## Keep Thin - Do not move scraping, parsing, selector, or cookie-loading logic into routes. - If route code starts branching on marketplace behavior, push that behavior back into `packages/core`. ## Route Conventions - Register new routes in `src/index.ts`. - Follow existing input precedence where present: `query` header first, then `q` search param. - Preserve existing response shape style: `Response.json(...)`, `400` for bad input/errors, `404` for empty result sets, `200` for success. - Keep query parameter names aligned with the MCP server because MCP builds URLs against these endpoints. ## Verify - `bun test packages/api-server/test` - `bun run --cwd packages/api-server build` - `bun run ci`