Giter Club home page Giter Club logo

workers-docs's Introduction

workers-docs's People

Contributors

1000hz avatar a-robinson avatar adamschwartz avatar adaptive avatar ashleygwilliams avatar ashleymichal avatar benadam11 avatar bradyjoslin avatar cherwoo avatar conzorkingkong avatar dependabot-preview[bot] avatar everlastingbugstopper avatar exvuma avatar gabbifish avatar hturan avatar ispivey avatar jahands avatar jbampton avatar jclee avatar jspspike avatar kristianfreeman avatar mpint avatar nchlswhttkr avatar neynah avatar nodebotanist avatar obsidianminor avatar rita3ko avatar steveklabnik avatar xortive avatar xtuc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

workers-docs's Issues

Add method examples for FetchEvent

We have existing content that includes examples for event.waitUntil() and event.passThroughOnException(). Add these to the FetchEvent runtime api reference document. Not a hard requirement for launch, but certainly low-hanging fruit.

Web Global APIs

Need to link to the appropriate docs for the six global methods implemented on our Service Worker Global scope. Part of #11

Document the Encoding API

Part of #11.

Document the objects, methods, properties. Indicate the non-standard behavior (we only encode to and decode from UTF-8; this conforms to the standard for Encoding, but not for Decoding).

Per my notes at https://wiki.cfops.it/display/EW/Runtime+API+Doc+Questions:

  • TextEncoder is missing TextEncoder.encodeInto(), but otherwise fully implemented. only encodes into UTF-8 (follows standard)
  • TextDecoder only supports decoding from UTF-8, (standard requires more) but otherwise fully implemented.
  • TextEncoderStream and TextDecoderStream are both unimplemented.

Change wording/organization of two templates

Help wanted in terms of feedback for how this new proposal is structured. it's a little work for me to redeploy all the demos, git repos, markdown etc.. for each template so I want to get it right this time around. Do you think this OK and worth the time? Should we combine/split things? rename suggestions?

https://github.com/cloudflare/workers-docs/blob/master/reference/templates/index.md
Sending and Receiving Data and Redirects are really confusing on the way it's organized with fetches and reading in requests.

Remy and I came up with organizing it as something like:

Subrequests

subrequest.js
Examples of making fetch requests from within your Worker script including generating JSON post requests then reading in the resulting response body, aggregating multiple requests into one response, and following/catching redirects.

Incoming requests

request.js
Examples of reading in a POST request body of type JSON and form-data and manipulating request headers before it reaches the origin server.

Redirects

redirect.js
Examples of sending single and bulk redirects from a Worker script.

Cross check config api documentation with actual behavior

The existing api documentation is out of sync; it says that on a successful DELETE of a script, it does not return a response body, however the code seems to indicate that it does. This may not be the only inconsistency; we should assess the whole API to confirm parity. Stretch goal: test suite for maintaining documentation parity.

Reference - Undocumented Endpoints

Some endpoints that are public are not documented. We should take careful stock of which of these we want to add documentation for, understanding that it's possible we may want to take the opportunity to change them before making them public.

Script Names

We have naming conventions for scripts. We should add this to the Script Object reference.

Document the Web Crypto API

Part of #11

Document our implementation of the WebCrypto API. At minimum we should document the surface of the API, but an article would also be helpful, as this api is full of 🐉s.

From my notes at https://wiki.cfops.it/display/EW/Runtime+API+Doc+Questions:
"this has a big red warning on the MDN doc site saying "if you don't know what this is, don't mess w/ it", which is appropriately scary, but we support it.
The WebCrypto API is a key feature, so it does feel weird that MDN is so discouraging of its use. However, I think some warning is appropriate, since you really do have to know what you're doing to use the SubtleCrypto API safely. We have some recipes which use the WebCrypto API. Perhaps we could list what algorithms we support and link to well-reviewed and commented examples of their use?"

Configuration Error Responses

This could potentially be split out into multiple issues:

  • Document the shape of an error message (the API sends in the form of a list of objects with code and message)
  • Per endpoint, document the possible error responses (HTTP status and error object(s)) that can be expected and what they mean. (Possible to break up by doc, i.e. routes/scripts/bindings).
  • The API Gateway can also return errors, as it processes the account/zone id URL parameters. Document or link to errors relevant to workers endpoints.

Audit Recipes

Let's list out the current recipes and choose which to salvage. We'll keep the list here and prioritize 3 to turn into templates and tutorials.

Rewriting Requests and Responses

Because of some odd idiosyncrasies within the Fetch API that become more apparent with our Service Worker applications, (see this issue in the fetch standard: whatwg/fetch#671), many of our users are surprised by unexpected loss of data when modifying requests and responses inside of their workers. Include a short article outlining best practices for modifying request and response objects from inside of a worker.

currently the PR associated with this has a good coverage of requests, not so much responses.

Service Worker API - Blurb

In addition to the pages about FetchEvent and CacheAPI, include a short blurb about our implementation of the Service Worker API; previous versions of our documentation simply said we implemented "as much as makes sense", which is only intuitive if you are already familiar with the product. This piece should indicate something about the lifecycle (or lack thereof) of our Service Worker implementation -- scripts are pushed to the edge, rather than downloaded like they are in the browser, so installation and activation steps are unnecessary; additionally, all implementation tied to the attempt to sync up the versions of all instances of service workers, as is done in the browser, is impractical for our 6000+ machine network, and therefore we don't attempt, meaning that more than one version of your script may be active at a time across our network.

create a Config your CF page

Minimum topics to cover:

  • Finding your Zone ID / Account ID in the Cloudflare Dashboard
  • Finding your Cloudflare API key

Link these from all tutorials, as well as the Config API index.

Link to Reference

Comb through the docs and figure out where reference links will be helpful and start adding relative links. This may need to wait until we have decided on our technical architecture.

Routing Tables

Config API includes endpoints to handle "routes" for workers, also known as "filters". Provide a brief overview of the concept on the Routes reference page, as well as an overview of how routes are arranged and how to think about precedence. Include the concept of a no-op, "placeholder" route.

Fetch API

Flesh out the Fetch API reference page.

Part of #11

Script Size

We compress bundles (workers with wasm bindings atm), and soon will compress all scripts. This makes the concept of script size a bit opaque. Let's call out this compression explicitly and provide users with a way to assess their bundle size without deploying a worker. This may include a little collaboration with the Config API to include size in more responses.

This should be addressed in the Plans and Limitations section of the reference documentation.

TODO: Quick Start

  • Move Cloudflare API keys/configuration section into re-usable part in Reference
  • Link to reference section of docs
  • Update generate project screenshot when JS support lands in wrangler
  • Update “Preview your Worker” image when JS support lands in Wrangler
  • Update “Publish your Project” section with Zoneless + Wrangler setup
  • Update “Install Wrangler” link

Editor

Document how to use the editor and it's constraints

Serverless

document serverless for multiscript and single

Add Article for Cache API

This is already started in #42 . Necessary additions:

Document the API surface (objects, methods, properties implemented). Use https://wiki.cfops.it/display/EW/Runtime+API+Doc+Questions for reference, link to mdn where appropriate.

Important to note:

  • put will throw an error if the request method is not GET
  • match will simply return undefined if the request method is not GET
  • put will also throw an error on a response with status code 206.

This issue is part of #11 and related to #44

Short Article: FetchEvent Lifecycle

This really has to do with clarifying when a fetch event is considered "done" and how that impacts async actions. Specifically deals with .respondWith and .waitUntil.

TODO: Guides, Build an Application: "Tutorial"

  • Move Cloudflare API keys/configuration section into re-usable part in Reference
  • Link to final version of codebase on GitHub
  • Explain that users need to know the script-name.subdomain.workers.dev URL they’re deploying to, before creating Slack config
  • Router NPM package?
  • Wrangler screenshot for build/publish
  • Link to GitHub source for Slack bot code
  • Link to second tutorial (“Building and deploying a serverless function on Cloudflare Workers”)
  • Link to Template Gallery

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.