Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bhar2254/cloudflare-workers-starter
A Cloudflare edge hosted Workers application for Bootstrap 5 UI development.
https://github.com/bhar2254/cloudflare-workers-starter
bootstrap cloud cloudflare edge js serverless website workers
Last synced: 25 days ago
JSON representation
A Cloudflare edge hosted Workers application for Bootstrap 5 UI development.
- Host: GitHub
- URL: https://github.com/bhar2254/cloudflare-workers-starter
- Owner: bhar2254
- License: gpl-3.0
- Created: 2024-06-07T04:02:13.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T20:50:50.000Z (about 1 month ago)
- Last Synced: 2024-12-10T21:35:09.381Z (about 1 month ago)
- Topics: bootstrap, cloud, cloudflare, edge, js, serverless, website, workers
- Language: JavaScript
- Homepage: https://cloudflare-starter-worker.blaineharper.com/
- Size: 138 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare Starter Worker
A simple starter project for creating, developing, and deploying Cloudflare Workers. This guide walks you through setting up a Cloudflare Worker using the Cloudflare CLI (`wrangler`), running it locally, and deploying it to Cloudflare's edge.
## Prerequisites
Before you begin, ensure you have the following installed:
- **Node.js** (v16 or higher recommended)
- **npm** or **yarn**
- **Wrangler** (Cloudflare's CLI tool)### Install Wrangler
```bash
npm install -g wrangler
```## Project Setup
1. **Clone the repository:**
```bash
git clone https://github.com//cloudflare-starter-worker.git
cd cloudflare-starter-worker
```2. **Install dependencies:**
```bash
npm install
```3. **Authenticate with Cloudflare:**
```bash
wrangler login
```This opens a browser window for you to authenticate and link Wrangler to your Cloudflare account.
## Local Development
1. **Start the local development server:**
```bash
wrangler dev
```2. **Access the Worker locally:**
Your Worker will be available at `http://127.0.0.1:8787`.Changes you make to the code will automatically reflect after refreshing the page.
## Deploying to Cloudflare
1. **Publish your Worker:**
```bash
wrangler publish
```2. **Verify the deployment:**
After deployment, Wrangler will provide a URL (typically `https://..workers.dev`).## Project Structure
- **`src/index.js`**: The main entry point for your Worker.
- **`wrangler.toml`**: Configuration file for Wrangler.
- **`package.json`**: Project dependencies and scripts.## Customization
- Update `wrangler.toml` with your specific settings, such as environment variables and account details.
- Extend functionality by adding routes and handling requests in `src/index.js`.## Resources
- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
- [Wrangler CLI Guide](https://developers.cloudflare.com/workers/wrangler/)