Extract server handler into separate module.