Feature/992 now hosting#1004
Conversation
|
@fabiosantoscode looks good, let's keep discussion going in the ticket. |
|
Dropping the reference, I forgot |
|
@fabiosantoscode quick question about new cache util: Does it cache response only for current user or for all users? It looks for me now that it is only cache response for the user who made it and any new user will make server response again. If I'm correct, then this is not a good option for us, because these requests for API are slow and will decrease out rate limit, while the content that we serve for different users are basically the same. |
|
@iAdramelk the cache is public. If you access https://blog-fihp2x2rk.now.sh/api/example-function with 2 different IPs (like with your phone on mobile data and your computer, or using a VPN) you will see the same timestamp. |
|
@fabiosantoscode tried it 3 browsers on the same IP and it seems that it works (but the request have only 60s maxAge). Where do you store example-function btw? I don't see it in changed files. |
|
(replied in #992 (comment)) |
| if (res) { | ||
| res.setHeader('cache-control', 'public, max-age=3600') | ||
| } |
There was a problem hiding this comment.
Why no cache from './utils/cache'?
| const res = await fetch(makeAbsoluteURL(req, item.source)) | ||
| const fetchRes = await fetch(makeAbsoluteURL(req, item.source)) |
There was a problem hiding this comment.
Maybe use docRes name
|
I like the cache code simplification.
I see the redirects work, but I don't see them in now.json in this PR? |
|
Closing since we're going for Heroku. |
Zeit now didn't pan out very well.
They have deprecated the custom node server (all hail cloud lock-in!), so we lose some flexibility there.
We can do redirects using now.json (except subdomain redirects, which need a separate branch hack to be achieved)
I have deployed this:
https://dvc-org-16jswpee8.now.sh
The API functions are working as normal.
Let me know if we can move forward from this point, as I don't want to spend time trying to get something to work that's going to be thrown away ⛄ .
Things should be better with gatsby + serverless functions, that was super easy to integrate earlier. However without a custom server it seems we lose some flexibility, and whether we make this tradeoff is not a decision I'm comfortable making.
My opinion is that we should go ahead with zeit now, because we will probably never need any custom server.