24ecdbd251
Add the first upload API endpoint from PLAN.md. POST /api/uploads now validates the requested file name, generates a server-owned upload id, creates the staging and complete directory layout, and writes durable meta.json before returning chunk scheduling details to the browser. Keep filesystem layout knowledge in storage.rs so later chunk upload and completion work can reuse the same boundary. API handlers translate storage errors into JSON HTTP responses without leaking layout details into the router. Document the new modules and UPL_DATA_DIR configuration, and extend TESTS.md with the automated creation coverage. Test Plan: - just check Refs: PLAN.md milestone 2
1.5 KiB
1.5 KiB
upl
upl is a small personal resumable upload service. The intended deployment is:
browser -> nginx -> upl Rust server -> local filesystem
The first implementation milestone provides the Rust server shell and static
browser UI. Upload metadata, chunk persistence, resume state, and completion
assembly are tracked in PLAN.md and will be added in later coherent slices.
Project Structure
upl
Rust server
src/main.rs binary entrypoint and listener setup
src/app.rs Axum router, shared state, static file service
src/api.rs HTTP handlers and API error responses
src/model.rs JSON request, response, and metadata shapes
src/storage.rs local filesystem layout and durable metadata writes
src/lib.rs library surface used by integration tests
Browser UI
static/index.html upload tool markup
static/styles.css responsive tool styling
static/app.js file-selection behavior
Validation
tests/ integration tests for server behavior
TESTS.md reusable manual and automated test checklist
Configuration
UPL_BINDsets the listen address. It defaults to127.0.0.1:3000.UPL_STATIC_DIRsets the static asset directory. It defaults tostatic/inside this repository.UPL_DATA_DIRsets the upload data directory. It defaults todata/inside this repository.
Common Commands
Use the justfile for routine tasks:
just check
just run