move api handlers to connect