parser-web is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the command-line executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install parser-web
It will make the parser-web command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall parser-web uninstalls.
Adding parser_web library as a dependency
Run this command in a terminal, in your project's directory:
cargo add parser-web
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
parser-web = "0.1.3"
The parser_web library will be automatically available globally.
Read the parser_web library documentation .
Back to the crate overview .
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.