server: refactor middleware registration

Move the code from the main server file into multiple smaller scripts
in `server/boot/`.