reordering server middleware