Lambda function handler isn't running when I add parts to the path

The file name where the lambda handler is written is called bar.js.

I want to be able type mywebsite.com/foo/bar, and the handler in the bar.js file runs.

I call fetch(.netlify/functions/bar?product=${foo}) when I type in mywebsite.com/foo/bar. The issue here is that ‘foo’ could be any word and it is not something I can predict. So I want ‘foo’ to be variable so I can’t just create the file foo.js for my lambda function.

I am not sure how to correctly make this work. Thanks!

Hi @mimib1230, it sounds like using a splat redirects rule would work for your use-case. Something like:

/:foo/bar /.netlify/functions/bar?product=:foo 200

Let me know if that works for you.