hello sunshine tests:

parameters & environment vars

  1. /params/singleParam (source)
  2. /params/multiple/parameters/in/the/url (source)
  3. /query?hello=sunshine&goodbye=rain (source)
  4. environment variable (source)
  5. ASSETS (index.html seems to be deleted) (source)

FormData

  1. FormData image converter (source) (FormData polyfish)

KV

  1. KV (source)
  2. ServeImages (source)
  3. Upload images and serve images from KV (source)

BasicAuth

  1. simple page protected by basic auth (source) (source2)
  2. logout (source)

Middleware

  1. errorHandler / middleware (source)

Testing preview and production branches

  • this page is visible in production, but not in preview branch.
  • this page is visible not in production, but in preview branch only.
  • Wrangler command

    setup test KV

    1. To create a local KV table for testing `TEST => {"hello", "sunshine"}`, you make: 1) a file `.mf/kv/TEST/hello` with the content `sunshine`. 2) For metadata, the file `.mf/kv/TEST/hello.meta.json` => `{"key":"hello","metadata":{"meta":"data"}}`
    2. If you need to add more complex data, you can write a worker or script that puts that data in the file for you.
    3. Be aware that when the key has `/` in it, then this will create folder structures. Todo find out how special characters such as space and percent% and hash# and colon: is handled.
    4. npx wrangler pages dev . --kv TEST --binding COLOR="red" --binding USER_PASS="hello:sunshine"