Skip to content

jakearchibald/random-stuff

Repository files navigation

Simple static & functions Cloudflare project

This is a Cloudflare "Workers & Pages" project. You can set it up to publish on push to GitHub, or manually via pnpm run publish.

For each request, it will:

  1. If the equivalent path is in public, it's served. Index files are served, e.g. public/foo/index.html will be served for requests to /foo/.
  2. Otherwise, if there's an equivalent route function (eg /hello/ will check for src/routes/hello/index.ts, /hello/bar will check for src/routes/hello/bar.ts), that file's default export is called to get the response.
  3. Otherwise, if there's no / at the end of the path, but there's an equivalent index.ts if the path did end with a /, then it redirects.
  4. Otherwise, 404.

public/_headers and public/_redirects are supported.

A root /index.html is generated, providing a list of top level URLs. Titles are 'scraped' from <title> in HTML, or // title: Hello! in route modules.

Running & developing

To install:

pnpm i

To dev:

pnpm run dev

To deploy, push to GitHub, or:

pnpm run deploy

I guess npm will work too.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published