cloudflare-client
itty-router
cloudflare-client | itty-router | |
---|---|---|
4 | 3 | |
20 | 1,645 | |
- | - | |
2.6 | 9.1 | |
almost 2 years ago | 8 days ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
cloudflare-client
-
curl: (60) SSL certificate problem on Cloudflare Container
% docker run --entrypoint /bin/sh -it oznu/cloudflare-ddns:latest -c "curl -vvI https://api.cloudflare.com/user/tokens/verify" | grep -A 8 "Server certificate" * Server certificate: * subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=api.cloudflare.com * start date: May 19 00:00:00 2022 GMT * expire date: May 19 23:59:59 2023 GMT * subjectAltName: host "api.cloudflare.com" matched cert's "api.cloudflare.com" * issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3 * SSL certificate verify ok. * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed)
-
Dynamic Subdomain Routing
this might workhttps://api.cloudflare.com/ based on what I found here https://community.cloudflare.com/t/create-a-subdomain-on-cloudflare-automatically/357063/2
-
Triggering Cloudflare Cache Purging with Netlify's Post-Deploy Hooks and a Google Cloud Function in Go
package purger import ( "fmt " "io" "log" "net/http" "strings" "github.com/GoogleCloudPlatform/functions-framework-go/functions" ) func init() { functions.HTTP("PurgeCache", purgeCache) } // httpError logs the error and returns an HTTP error message and code. func httpError(w http.ResponseWriter, err error, msg string, errorCode int) { errorMsg := fmt.Sprintf("%s: %v", msg, err) log.Printf("%s", errorMsg) http.Error(w, errorMsg, errorCode) } func purgeCache(w http.ResponseWriter, r *http.Request) { log.Printf("Received %s from %v", r.Method, r.RemoteAddr) if r.Method == "POST" { body, err := io.ReadAll(r.Body) if err != nil { httpError(w, err, "error reading POST body", http.StatusInternalServerError) return } log.Printf("Request body: %s", body) } // Send POST request to Cloudflare client := &http.Client{} data := `{"purge_everything":true}` req, err := http.NewRequest("POST", "https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache", strings.NewReader(data)) if err != nil { httpError(w, err, "error creating new Request", http.StatusInternalServerError) return } req.Header.Add("Authorization", "Bearer CLOUDFLARE-API-TOKEN") req.Header.Add("Content-Type", "application/json") cloudflareResp, err := client.Do(req) if err != nil { httpError(w, err, "error sending POST request", http.StatusInternalServerError) return } defer cloudflareResp.Body.Close() // Pass cloudflare response to caller cloudflareRespBody, err := io.ReadAll(cloudflareResp.Body) if err != nil { httpError(w, err, "error reading Cloudflare response", http.StatusInternalServerError) return } if cloudflareResp.StatusCode != http.StatusOK { msg := fmt.Sprintf("error non-200 status: %s", cloudflareRespBody) httpError(w, nil, msg, http.StatusInternalServerError) return } log.Printf("Cloudflare response: %s", cloudflareRespBody) _, err = w.Write(cloudflareRespBody) if err != nil { httpError(w, err, "error sending response to client", http.StatusInternalServerError) return } }
-
Cloudflare API Client Library
I've just built a small fetch-based, zero-dependency JavaScript library for Cloudflare API that works in Node.js, Deno, and CF Workers environment — https://github.com/kriasoft/cloudflare-client
itty-router
-
Ask HN: Which stack is as boring (good boring) and cheap in 2023 as PHP?
Instead of Next and it's bloat, you should try Svelte, a barebones Svelte (not SvelteKit) app feels like a breeze to scaffold and deploy through Netlify or Vercel with nearly 0 configuration. The same can be said about SvelteKit, though you can just get away by using a minimal router like Itty (https://github.com/kwhitley/itty-router) with barebones Svelte (just run npx create-vite, and follow the interactive scaffold process).
-
Build a scalable URL shortener in 10 minutes with Cloudflare Workers and KV
To further simplify development, since we are going to make more than 1 endpoint, we'll install itty-router which is an Express like router to automatically parse out the HTTP method, query params, path params, etc. I also prefer to use prettier to format the code so that it looks consistent.
-
What do you use to validate user input for Cloudflare Workers?
Is there any good input validator I can use with itty-router for Cloudflare Workers? I am looking for something like express-validator.
What are some alternatives?
notion-api-worker - Notion as CMS with easy API access
http-server - AdonisJS HTTP Server along with its Router
vscode-restclient - REST Client Extension for Visual Studio Code
shortener - URL Shortener powered by Cloudflare Workers and KV
redirect.center - Redirect domains using DNS only
template-worker-tempo - A template that demonstrates using the Tempo in your Cloudflare Workers.
relay-starter-kit - 💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, and Joy UI. [Moved to: https://github.com/kriasoft/graphql-starter-kit]
cloudflare-worker-router - A super lightweight router (1.0K) with middleware support and ZERO dependencies for Cloudflare Workers.
Favifetch - A website favicon & icon API, powered by Cloudflare Workers
nodejs-api-starter - 💥 Yarn v2 based monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI. [Moved to: https://github.com/kriasoft/relay-starter-kit]
prettier - Prettier is an opinionated code formatter.
aws-gocljs - fullstack web should be easy