Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prisma/deployment-example-cloudflare-workers
Cloudflare workers deployment example
https://github.com/prisma/deployment-example-cloudflare-workers
Last synced: about 2 months ago
JSON representation
Cloudflare workers deployment example
- Host: GitHub
- URL: https://github.com/prisma/deployment-example-cloudflare-workers
- Owner: prisma
- Created: 2023-06-09T09:06:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-24T17:06:58.000Z (over 1 year ago)
- Last Synced: 2023-07-24T17:43:28.163Z (over 1 year ago)
- Language: TypeScript
- Size: 24.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cloudflare Workers Deployment Example
## Getting started
Clone the example:
```bash
git clone [email protected]:prisma/deployment-example-cloudflare-workers
```Install the dependencies:
```bash
cd deployment-example-cloudflare-workers
npm install
```Create a `.env` file:
```bash
cp .env.sample .env
```Update the `DIRECT_DATABASE_URL` environment variable to point ot your database:
```bash
DIRECT_DATABASE_URL="postgresql://johndoe:[email protected]:5432/deployment-example-cloudflare-workers"
```Configure your database connection string and an [Accelerate connection string](https://prisma.io/accelerate?q=TODO):
```bash
# .env
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=API_KEY"
```Update your `wrangler.toml` file with your Accelerate connection string
```toml
# wrangler.toml
[vars]
DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=API_KEY"
```Start up the application
```
npm run dev
```Open up [http://127.0.0.0:8787](http://127.0.0.0:8787) in your browser to make sure it's working
Deploy the application:
```
npm run deploy
```