simonw / datasette-publish-vercel

Datasette plugin for publishing data using Vercel
Apache License 2.0
44 stars 7 forks source link

Stop using "builds", switch to using "functions" #33

Open simonw opened 3 years ago

simonw commented 3 years ago

https://vercel.com/docs/configuration#project/builds suggests that "builds" will eventually be deprecated. We use that here: https://github.com/simonw/datasette-publish-vercel/blob/2a4723e4df1b69a232617109d4366ea357578b10/datasette_publish_vercel/__init__.py#L204

simonw commented 3 years ago

It looks like functions have to run out of an api directory - https://vercel.com/docs/configuration#project/functions

But then the "rewrites" mechanism can hopefully be used to say "all traffic to /* should be handed off to this function". https://vercel.com/docs/configuration#project/rewrites

{
  "rewrites": [
    { "source": "/about", "destination": "/about-our-company.html" },
    { "source": "/resize/:width/:height", "destination": "/api/sharp" },
    { "source": "/user/:id", "destination": "/api/user" },
    { "source": "/proxy/:match*", "destination": "https://example.com/:match*" }
  ]
}

So presumably we would need something like this:

{
  "rewrites": [
    { "source": "/:path*", "destination": "/api/datasette.py/:match*" },
  ]
}
simonw commented 3 years ago

This may be why I've not been able to test the Vercel fix for the percent encoding issue in #28 - https://github.com/vercel/vercel/issues/5575#issuecomment-775957688