https://github.com/lpil/gleam-cloudflare-worker
https://github.com/lpil/gleam-cloudflare-worker
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lpil/gleam-cloudflare-worker
- Owner: lpil
- License: apache-2.0
- Created: 2021-08-29T09:42:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-30T15:48:53.000Z (over 2 years ago)
- Last Synced: 2025-01-22T05:42:14.582Z (over 1 year ago)
- Language: Gleam
- Homepage: https://gleam-cloudflare-worker.lpil.workers.dev/
- Size: 61.5 KB
- Stars: 32
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# workers-gleam-template ✨
A batteries included template for kick starting a Gleam Cloudflare worker project.
## 🔋 Getting Started
This template uses Wrangler, the CloudFlare Workers CLI. If you are not already
familiar with the tool then I recommend that you get familiar with it, and
configure it to work with your [Cloudflare account](https://dash.cloudflare.com).
Documentation can be found [here][wrangler-docs].
[wrangler-docs]: https://developers.cloudflare.com/workers/tooling/wrangler/
To generate using Wrangler, run this command:
```sh
npx wrangler generate my-gleam-project https://github.com/lpil/gleam-cloudflare-worker
```
This example uses the OpenWeatherMap API, so create a file at `.dev.vars` with
an API key, and add it to CloudFlare Secrets if you wish to publish to
CloudFlare.
```sh
# Local development secret
echo "OPEN_WEATHER_MAP_API_KEY=your api key goes here" >> .dev.vars
# Cloudflare production secret
npx wrangler secret put OPEN_WEATHER_MAP_API_KEY
```
## 📝 Usage
```sh
# Run a local development server
npm run dev
# Deploy to Cloudflare
npm run deploy
```