parser-web

Crates.ioparser-web
lib.rsparser-web
version0.1.3
created_at2025-03-21 03:22:28.617076+00
updated_at2025-03-21 03:22:28.617076+00
descriptionWeb API for extracting text from various file formats
homepage
repositoryhttps://github.com/excoffierleonard/parser
max_upload_size
id1600054
size104,090
Leonard Excoffier (excoffierleonard)

documentation

https://docs.rs/parser-web

README

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.

Commit count: 352

cargo fmt