Skip to content

Feature/992 now hosting#1004

Closed
fabiosantoscode wants to merge 3 commits into
treeverse:masterfrom
fabiosantoscode:feature/992-now-hosting
Closed

Feature/992 now hosting#1004
fabiosantoscode wants to merge 3 commits into
treeverse:masterfrom
fabiosantoscode:feature/992-now-hosting

Conversation

@fabiosantoscode
Copy link
Copy Markdown
Contributor

@fabiosantoscode fabiosantoscode commented Feb 17, 2020

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.

@shcheklein
Copy link
Copy Markdown
Contributor

@fabiosantoscode looks good, let's keep discussion going in the ticket.

@fabiosantoscode
Copy link
Copy Markdown
Contributor Author

Dropping the reference, I forgot

#992

@iAdramelk
Copy link
Copy Markdown
Contributor

@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.

@fabiosantoscode
Copy link
Copy Markdown
Contributor Author

@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.

@iAdramelk
Copy link
Copy Markdown
Contributor

@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.

@fabiosantoscode
Copy link
Copy Markdown
Contributor Author

(replied in #992 (comment))

Comment thread pages/doc.js
Comment on lines +39 to +41
if (res) {
res.setHeader('cache-control', 'public, max-age=3600')
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no cache from './utils/cache'?

Comment thread pages/doc.js
Comment on lines -48 to +53
const res = await fetch(makeAbsoluteURL(req, item.source))
const fetchRes = await fetch(makeAbsoluteURL(req, item.source))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use docRes name

@jorgeorpinel
Copy link
Copy Markdown
Contributor

I like the cache code simplification.

We can do redirects using now.json (except subdomain redirects, which need a separate branch hack to be achieved)

I see the redirects work, but I don't see them in now.json in this PR?

@fabiosantoscode
Copy link
Copy Markdown
Contributor Author

Closing since we're going for Heroku.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants