You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/websites.mdx
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,33 @@ websites:
94
94
url: http://localhost:4323
95
95
```
96
96
97
+
## Conflicting Routes
98
+
99
+
If you have conflicting routes between your API and website or between multiple sub-sites, you can configure the `path` for each website to avoid conflicts.
100
+
101
+
### Reserved Paths
102
+
103
+
The following paths are reserved for use by the Nitric framework and cannot be used as website paths:
104
+
105
+
- `/api`used to rewrite API requests
106
+
107
+
## API Routes
108
+
109
+
Nitric automatically serves your API under the `/api` path. You can access your API routes at `https://<your-site>/api/<your-api>/<your-route>`.
110
+
111
+
By serving your API under the same domain as your website, you avoid CORS issues and can use relative paths to access your API.
112
+
113
+
Here is an example of calling an API route from your website:
114
+
115
+
```javascript
116
+
async function fetchData() {
117
+
// due to apis being served from the same domain thanks to rewrites, no CORS is required
0 commit comments