Moving func from server.js to router.js

Removed internalError function because not used.