Decomposed /api/record into sub-modules, reused common code, and implemented POST /api/record