App dev with remix template - Best way to process incoming data from the client?

Hi, where did you add this code? I’ve been trying to for hours and can’t get it working. I’ve added a product.js file in app/routes/api/ and all it ever does it return the code on that page when going to the endpoint https://{cloudflare-url}/app/routes/api/products. What am i doing wrong here?