This is the code repository for the guide on how to deploy a Cloudflare worker application using Neon. Follow the guide to set up the Neon project and your Cloudflare application.
Run the command below to copy the .env.example
file to a .dev.vars
file in the code directory:
cp .env.example my-neon-worker/.dev.vars
Store your Neon credentials in this .dev.vars
file.
DATABASE_URL="postgresql://neondb_owner:[email protected]/neondb?sslmode=require"
user
is the database user.password
is the database user’s password.endpoint_hostname
is the host with neon.tech as the TLD.dbname
is the name of the database. “neondb” is the default database created with each Neon project.?sslmode=require
an optional query parameter that enforces the SSL mode while connecting to the Postgres instance for better security.
Important: To ensure the security of your data, never expose your Neon credentials to the browser.
Navigate to the my-neon-worker
directory, and install the dependencies:
cd my-neon-worker && npm install
Now, run the command below to deploy the application locally:
npx wrangler dev
Follow the guide for instructions on how to deploy the application to the Cloudflare Workers platform. Make sure to add the Neon connection string as a secret to your Worker application.