I want the URL " domain.com/message/* " to redirect to a Netlify function and serve the response from the function as the page contents

I’m building an application where people can post messages to a feed. I want to set up the URL routing, so that domain.com/message/* redirects to the function getMessage.js and returns the response of getMessage.js as the contents of domain.com/message/*. Can somebody help me do this? I haven’t quite figured it out from the documentation, any help and examples would be much appreciated.


  force = true
  from = "/message/*"
  status = 200
  to = "/.netlify/functions/getMessage"

OR _redirects:

/message/* /.netlify/functions/getMessage 200!
1 Like

Thank you for this! I ended up implementing it as:

  from = "api/*"
  to = "/.netlify/functions/getMessage/:splat"
  status = 200

Is the :splat necessary in this context to give the wildcard value to getMessage, or is it not needed?