add connect directory middleware support