converted router coffee to js