move conntection to /api