Fixed server bug, made controllerFunctions.js

controllerFunctions.js  - holds functions that can by used by all
controllers