Fix API not working for /:id routes