server logic for nodejs