Refactor: split into multiple files

Given the size of the assignment, having everything in the same file was
OK. However, splitting into different files is a good option for better
maintainance once this API grows, and now is a good time to do it before
it gets more complicated.
This commit is contained in:
2026-02-01 03:06:00 +01:00
parent 1f62fe6f66
commit b78b8cca41
10 changed files with 254 additions and 227 deletions

View File

@@ -15,12 +15,26 @@ This project uses Leiningen. Assuming you already have Leiningen installed,
running the API should be as easy as cloning the repo and issuing `lein run`. By
default, the server listens on port 3000.
## Structure
The source code lies in `/src/yohoho` and is structured as follows:
* `app.clj`: ring app and main entrypoint
* `config.clj`: configuration (database and HTTP server)
* `db.clj`: functions that directly interact with the database
* `handlers.clj`: route handlers
* `helpers.clj`: the infamous file that holds function that are useful but
couldn't fit anywhere else
* `routes.clj`: API routes
* `schemas.cls`: Malli schemas used for validation
## Library choices
* `reitit`: for handling routes
* `jetty`: web server
* `muuntaja`: JSON handling
* `next.jdbc`: database interface (SQLite)
* `malli`: validation
## Documentation links