Add backend database logic for favorites feature using REST API