moved server code

Moved server code to the file server.js