neverendingqs / netlify-express

Express.js hosted on Netlify
https://netlify-express.netlify.app/
Apache License 2.0
321 stars 342 forks source link

Is this compatible with Gatsby somehow? #7

Closed b3nk3 closed 5 years ago

b3nk3 commented 5 years ago

Hi There, have you got any advice how to get this working from within Gatsby? I suspect the issue is coming from routing...

It works locally, but I get Cannot GET /.netlify/functions/server/ when visiting the location.

neverendingqs commented 5 years ago

Hi @b3nk3,

Sorry I am not familiar with Gatsby. Where are you making the GET from?

b3nk3 commented 5 years ago

Hi @b3nk3,

Sorry I am not familiar with Gatsby. Where are you making the GET from?

on my url on netlify. I'm suspecting, since Gatsby has its own router this might be the cause of the issue with the functions?

Whilst we are at it, I'm querying a third party API that has some max request limits, hence I'd need to cache the results. I can achieve this fine with Firebase Functions, is Netlify able to do the same? https://firebase.google.com/docs/hosting/functions

If not it is not worth for me to put more effort into getting this express server working from under Gatsby. (it does work locally though)

neverendingqs commented 5 years ago

on my url on netlify. I'm suspecting, since Gatsby has its own router this might be the cause of the issue with the functions?

That might be the case. I recommend checking Gatsby docs for bypassing it.

You can, though, configure caching behavior for dynamic content. For example, if a function generates content only periodically, you can speed up your app by caching the generated content for at least a short period of time. You can also potentially reduce function execution costs because the content is served from the CDN rather than via a triggered function. Read more about optimizing function execution in the Cloud Functions documentation.

I do not believe Netlify supports that at this time.