Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceharrison1984 committed Apr 23, 2024
1 parent f728231 commit e2362c8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,23 @@ Add a `tsconfig.json` file to the `functions` directory to fix type issues:

Start development mode by running `vite`.

## Vite Plugin Configuration

All settings are optional, with the default being used when no other value is set.

| Name | Description | Default |
| ------------------ | :--------------------------------------------------------------------------------------------------------------: | -------------------------: |
| allowedApiPaths | These are url paths that should be directed to the Cloudflare function, and not the SPA. | `["/api/*]` |
| excludedApiPaths | These are url paths that should **not** be directed to the Cloudflare function, and will always route to the SPA | `[]` |
| functionEntrypoint | The file that will be used as the entry point for the Cloudflare Pages functions | `functions/index.ts` |
| wranglerConfig | Pass through for Wrangler configuration objects | see Wrangler documentation |
| wranglerConfigPath | Location of your `wrangler.toml` file for usage in setting up Wrangler local services | `wrangler.toml` |
| external | Any Function packages that should not be bundled | `[]` |

## API Endpoints

_By default we use [Hono](https://hono.dev/top) as the router, but any other Cloudflare Functions compatible router could be
used as well._
_By default we presume [Hono](https://hono.dev/top) as the router, but any other Cloudflare Functions compatible router
could be used as well._

API endpoints are ran via Pages Functions. Cloudflare services should be available on the Context object with the router.

Expand Down Expand Up @@ -133,8 +146,8 @@ const route = app.get('/page', (c) => {
You can also utilize Hono's built in RPC functions to automatically map your Function API into your React SPA. See the
[Hono documentation](https://hono.dev/guides/rpc) for more information about this feature.

_Beware importing files from `functions` into your frontend application. Depending on how they are exported, it could pull
your entire Function bundle into your frontend code_
_**Beware importing files from `functions` into your frontend application. Depending on how they are exported, it could pull
your entire Function bundle into your frontend code**_

```ts
//App.tsx
Expand All @@ -152,19 +165,6 @@ useEffect(() => {
}, []);
```

## Vite Plugin Configuration

All settings are optional, with the default being used when no other value is set.

| Name | Description | Default |
| ------------------ | :--------------------------------------------------------------------------------------------------------------: | -------------------------: |
| allowedApiPaths | These are url paths that should be directed to the Cloudflare function, and not the SPA. | `["/api/*]` |
| excludedApiPaths | These are url paths that should **not** be directed to the Cloudflare function, and will always route to the SPA | `[]` |
| functionEntrypoint | The file that will be used as the entry point for the Cloudflare Pages functions | `functions/index.ts` |
| wranglerConfig | Pass through for Wrangler configuration objects | see Wrangler documentation |
| wranglerConfigPath | Location of your `wrangler.toml` file for usage in setting up Wrangler local services | `wrangler.toml` |
| external | Any Function packages that should not be bundled | `[]` |

### Allowed/Excluded Api Paths

**Excluded api paths take precedence over allowed api paths**
Expand Down

0 comments on commit e2362c8

Please sign in to comment.