Implemented Server functions

Implemented the server-side functions for server.js