Skip to content

Latest commit

 

History

History

netlify

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Netlify Edge Function

Connect to the TiDB serverless from the Netlify Edge Function using deno mysql driver.

You can deploy it with netlify cli:

netlify deploy

Live endpoints

Why not serverless driver?

Netlify edge runtime is based on the Deno deploy. Deno mysql driver over TCP is more suitable as we have made it compatible with TiDB serverless.

Still want to use serverless driver? Here is an example:

import { connect } from 'https://esm.sh/@tidbcloud/serverless'

export default async () => {
  const conn = connect({url: Netlify.env.get('DATABASE_URL')})
  const result = await conn.execute('show tables')
  return new Response(JSON.stringify(result));
}

export const config = { path: "/example" };