Refactor and decouple REST api framework

The recording API endpoints have been moved from the server.py module to a new class called recording.py.
This is probably not in the scope of this PR, but FWIW this mocking is flawed - it never actually undoes the patching. Maybe you can open an issue regarding fixing these tests so we don't forget about it later.