Reduced duplication in main.server.js.

Signed-off-by: marco.minetti <marco.minetti@novetica.org>