adding server logic and changing app directory structure