Skip to content

Commit

Permalink
Updates docs
Browse files Browse the repository at this point in the history
  • Loading branch information
infomiho committed Oct 18, 2023
1 parent 634b964 commit e1697be
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion web/docs/project/client-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,24 @@ explained in

Read more about the setup function in the [API Reference](#setupfn-clientimport).

## Base Directory

If you need to serve the client from a subdirectory, you can use the `baseDir` option:

```wasp title="main.wasp"
app MyApp {
title: "My app",
// ...
client: {
baseDir: "/my-app",
}
}
```

This means that if you serve your app from `https://example.com/my-app`, the
router will work correctly, and all the assets will be served from
`https://example.com/my-app`.

## API Reference

<Tabs groupId="js-ts">
Expand All @@ -290,7 +308,8 @@ app MyApp {
// ...
client: {
rootComponent: import Root from "@client/Root.tsx",
setupFn: import mySetupFunction from "@client/myClientSetupCode.ts"
setupFn: import mySetupFunction from "@client/myClientSetupCode.ts",
baseDir: "/my-app",
}
}
```
Expand Down Expand Up @@ -413,3 +432,12 @@ Client has the following options:

</TabItem>
</Tabs>

- #### `baseDir: String`

If you need to serve the client from a subdirectory, you can use the `baseDir` option.

If you set `baseDir` to `/my-app` for example, that will make Wasp set the `basename` prop of the `Router` to
`/my-app`. It will also set the `base` option of the Vite config to `/my-app`.

This means that if you serve your app from `https://example.com/my-app`, the router will work correctly, and all the assets will be served from `https://example.com/my-app`.

0 comments on commit e1697be

Please sign in to comment.