diff --git a/apps/docs-app/docs/features/api/overview.md b/apps/docs-app/docs/features/api/overview.md index 048e544c6..e239d48bb 100644 --- a/apps/docs-app/docs/features/api/overview.md +++ b/apps/docs-app/docs/features/api/overview.md @@ -20,14 +20,14 @@ To create an RSS feed for your site, set the `content-type` to be `text/xml` and ```ts //server/routes/rss.xml.ts -import { defineEventHandler } from 'h3'; +import { defineEventHandler, setHeader } from 'h3'; export default defineEventHandler((event) => { const feedString = ` `; - event.node.res.setHeader('content-type', 'text/xml'); - event.node.res.end(feedString); + setHeader(event, 'content-type', 'text/xml'); + return feedString; }); ``` @@ -83,7 +83,7 @@ Dynamic API routes are defined by using the filename as the route path enclosed import { defineEventHandler } from 'h3'; export default defineEventHandler( - (event: H3Event) => `Hello ${event.context.params?.['name']}!` + (event) => `Hello ${event.context.params?.['name']}!` ); ``` @@ -219,4 +219,4 @@ export const load = async ({ event }: PageServerLoad) => { ## More Info -API routes are powered by [Nitro](https://nitro.unjs.io). See the Nitro docs for more examples around building API routes. +API routes are powered by [Nitro](https://nitro.unjs.io/guide/routing) and [h3](https://h3.unjs.io/). See the Nitro and h3 docs for more examples around building API routes. diff --git a/apps/docs-app/docs/features/deployment/providers.md b/apps/docs-app/docs/features/deployment/providers.md index 81d07fed1..6e6196819 100644 --- a/apps/docs-app/docs/features/deployment/providers.md +++ b/apps/docs-app/docs/features/deployment/providers.md @@ -155,6 +155,27 @@ To connect your repository and deploy automatically to Cloudflare: The application deploys to Cloudflare's network on each push to the repository. +:::note + +For Nx workspaces, the build output is be under the app name, so you can update the client output directory and server output directory to `./dist` and `./dist/_worker.js` instead. + +``` +output: { + dir: './dist', + serverDir: './dist/_worker.js', +}, +``` + +After that, enter `YOUR_APP_NAME/dist` as the `Build output directory`. + +To test the build locally, run the following command: + +``` +BUILD_PRESET=cloudflare-pages npx nx build YOUR_APP_NAME +``` + +::: + ### Running the application locally using Wrangler You can also preview the application running on Cloudflare locally: