netlify / netlify-plugin-gatsby

A build plugin to integrate Gatsby seamlessly with Netlify

Home Page:https://www.npmjs.com/package/@netlify/plugin-gatsby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Background functions

sjelfull opened this issue · comments

Thanks for suggesting a new feature!

Please fill in the sections below.

Which problem is this feature request solving?

How do I use background functions with this plugin? It doesn't seem to work out of the box, since it will generate functions named __api etc.

Describe the solution you'd like

This would be fixed by gathering any functions with -background suffix into its own __api-background function.

Can you submit a pull request?

No

Hi @sjelfull,

Thanks for reaching out with your request!

In order to use background functions in your Gatsby project you would have to create a netlify/functions directory at the root of your project and put the background functions you're interested in adding to your project there, no other configuration should be necessary.

Once that's done, you can invoke the background function like you would an ordinary Gatsby function.

If things are set up correctly, you should see the a .zip file with the same name as the background function that you created in the .netlify/functions directory that's created after running the netlify build command on the command line.

Hope that helps, and don't hesitate to let us know if you have any follow up questions.