Skip to content

Feature: Implement REST API for Redaction Service #3

@matthewgoluba

Description

@matthewgoluba

Create a standalone Bun HTTP server that can accept external requests for redaction. This allows tools like Tampermonkey scripts or internal dashboards to utilize the redaction engine programmatically.

Architecture:

  • Standalone Bun HTTP server in packages/api/
  • Works on-prem and can be deployed to Vercel
  • No Next.js - pure Bun native HTTP

Requirements:

  • Endpoint: POST /api/redact
  • Payload: JSON object { text: string, config?: object, preset?: string }
  • Response: JSON object { redactedText: string, stats: {...}, mapping: {...} }
  • CORS: Must be configured to allow requests from external origins (for browser scripts)

Tasks:

  • Create packages/api/server.ts with Bun.serve()
  • Implement POST /api/redact endpoint
  • Implement GET /api/health endpoint for monitoring
  • Add CORS middleware/headers
  • Implement error handling for malformed JSON
  • Add bun api script to package.json

Metadata

Metadata

Assignees

Labels

apiREST API relatedenhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions