@stonyx/rest-server 0.2.1-alpha.32 → 0.2.1-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Configuration is read from `stonyx/config` under `restServer`:
|
|
|
74
74
|
| Option | Type | Default | Description |
|
|
75
75
|
| :---------------: | :-----------------: | :---------- | :--------------------------------------------------------- |
|
|
76
76
|
| `dir` | **String** | `'./requests'` | Directory containing request classes to mount as routes |
|
|
77
|
-
| `camelCaseRoutes` | **Boolean** | `
|
|
77
|
+
| `camelCaseRoutes` | **Boolean** | *(unset — `config/environment.js` sets no default)* | When explicitly `true`, converts hyphenated filenames to camelCase when generating route paths. Unset, so filenames are used **verbatim** |
|
|
78
78
|
| `port` | **Number** | `2666` | Port to listen on |
|
|
79
79
|
| `origin` | **String \| Array** | `'*'` | CORS origin(s) allowed |
|
|
80
80
|
| `methods` | **String** | `'GET,POST,PATCH,PUT,DELETE'` | CORS allowed methods |
|
|
@@ -116,7 +116,7 @@ Case-sensitive matching is a **behaviour change**. Requests that previously reac
|
|
|
116
116
|
**Who is affected:**
|
|
117
117
|
|
|
118
118
|
* Any client sending a URL whose case does not exactly match the mounted path — hand-written links, bookmarked or cached URLs, third-party callers, anything that upper-cases path segments.
|
|
119
|
-
* Any app with a capitalised or hyphenated request filename. Mount paths come from filenames, and `camelCaseRoutes` never lower-cases anything: it only upper-cases the letter following a `-`. So `Users.ts` mounts at `/Users` under **both** `camelCaseRoutes` settings, including the default `
|
|
119
|
+
* Any app with a capitalised or hyphenated request filename. Mount paths come from filenames, and `camelCaseRoutes` never lower-cases anything: it only upper-cases the letter following a `-`. So `Users.ts` mounts at `/Users` under **both** `camelCaseRoutes` settings, including the default. `phone-number.ts` mounts at `/phone-number` by default — `config/environment.js` declares no `camelCaseRoutes` key, so filenames are used verbatim — and at `/phoneNumber` only if you have explicitly set `camelCaseRoutes: true`. Clients that hardcode `/users` or `/phonenumber` start 404ing.
|
|
120
120
|
* Anything matching the URL downstream of the router — reverse proxies, WAF path rules, analytics path grouping, `originalUrl`-based routing.
|
|
121
121
|
* `GET /HEALTH` no longer answers. Only `GET /health` does.
|
|
122
122
|
|
|
@@ -138,7 +138,7 @@ If routes appear to have vanished after upgrading, `Cannot GET` in the response
|
|
|
138
138
|
ls requests/ # every filename becomes a mount path
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
Any filename that is not already all-lowercase
|
|
141
|
+
Any filename that is not already all-lowercase produces a mixed-case mount that now requires exact casing from callers. Hyphenated filenames are **not** affected by default, because `camelCaseRoutes` is unset and filenames are used verbatim; they are only at risk if you have explicitly set `camelCaseRoutes: true`, which mounts `phone-number.ts` at `/phoneNumber`.
|
|
142
142
|
|
|
143
143
|
**Opting out (temporary).** Two forms, and they are **not** interchangeable:
|
|
144
144
|
|
|
@@ -237,7 +237,7 @@ project-root/
|
|
|
237
237
|
* `public.js` — contains public-facing routes without authentication
|
|
238
238
|
* `private.js` — contains routes with authentication via the `auth` hook
|
|
239
239
|
|
|
240
|
-
The `RestServer` will automatically mount these routes using the filenames as paths (`/public` and `/private` by default, or
|
|
240
|
+
The `RestServer` will automatically mount these routes using the filenames as paths (`/public` and `/private` by default, or camelCased if `camelCaseRoutes` is enabled).
|
|
241
241
|
|
|
242
242
|
### Example Requests
|
|
243
243
|
|