backend database queries and route