1 unstable release

Uses new Rust 2024

new 0.1.3 Mar 21, 2025

#392 in HTTP server

MIT license

5.5MB
694 lines

Parser Web API

REST API and web interface for the parser-core library, enabling document parsing through HTTP requests.

Features

  • RESTful API for document parsing
  • Optional static file serving for web interface
  • Multipart file upload support
  • Containerized deployment ready

Installation

# Build from source
cargo build -p parser-web

# Run with default settings
cargo run -p parser-web

Configuration

Environment variables:

  • PARSER_APP_PORT: API server port (default: 8080)
  • ENABLE_FILE_SERVING: Enable static file serving (default: false)
  • RUST_LOG: Logging level (default: info)

API Endpoints

Parse Documents

POST /parse

Request Body

Multipart form with one or more files using the key file.

Response

{
    "texts": [
        "Parsed text of first document.",
        "Parsed text of second document."
    ]
}

Status Codes

  • 200 OK: Successfully parsed documents
  • 400 Bad Request: Invalid request format
  • 500 Internal Server Error: Parsing failed

Example Usage

# Upload and parse a single file
curl -X POST \
     -F "file=@document.pdf" \
     http://localhost:8080/parse

# Upload and parse multiple files
curl -X POST \
     -F "file=@document1.pdf" \
     -F "file=@document2.docx" \
     http://localhost:8080/parse

Web Interface

When ENABLE_FILE_SERVING=true, the server provides a simple web interface at the root URL for testing the API.

Dependencies

~46–62MB
~1M SLoC