GithubHelp home page GithubHelp logo

myzie / cf-worker-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pgedge/cloudflare-worker-template

0.0 0.0 0.0 8 KB

Bootstrap your Cloudflare Worker to connect to a pgEdge database

License: MIT License

TypeScript 100.00%

cf-worker-template's Introduction

cf-worker-template

Bootstrap your Cloudflare Worker to connect to a pgEdge database

Deploy to Cloudflare Workers

This is a simple Cloudflare Worker that connects to a pgEdge database. Use it as a starting point for your own project.

pgEdge connection

To find your pgEdge connection string, go to the pgEdge console. If you have not yet signed up for pgEdge, you can easily sign in with your social accounts. Creating a new database is free and takes less than a minute.

Once you've reached the console, navigate to the database you want to connect to. In the Connect to your database section, you will find your username, password, and the host is the Domain.

DB connection

The database connection is configured using the DB environment variable. The value should be in connection string format, e.g. postgres://user:pass@host/dbname?sslmode=required. This value can be added to Cloudflare using wrangler like so:

wrangler secret put DB

Additionally, you should make a .dev.vars file and set the DB environment variable there as well so that you can run the worker locally.

Cloudflare Token

You will need to set two repository secrets in your repo in order to deploy to Cloudflare. The first is CF_ACCOUNT_ID which is your Cloudflare account ID. The second is CF_API_TOKEN which is a token that you can generate from the API Tokens section of the Cloudflare dashboard.

cf-worker-template's People

Contributors

gbrowdy avatar myzie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.