Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info to docs on how middlewareConfig Map is consumed #2263

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export const serverMiddlewareFn = (middlewareConfig) => {
}
```
</TabItem>
<TabItem value="ts" label="TypeScript">

<TabItem value="ts" label="TypeScript">

```wasp {6} title=main.wasp
app todoApp {
Expand All @@ -132,6 +132,9 @@ export const serverMiddlewareFn: MiddlewareConfigFn = (middlewareConfig) => {
</TabItem>
</Tabs>

You are able to manipulate the `middlewareConfig` `Map` here as much as you want: delete entries, add entries, ... . Or construct a completely new Map. But keep in mind that you could easily mess up how the Wasp app works, as some of the middleware is expected and required. Check above for more info on each preset middleware.

Middleware from the `middlewareConfig` `Map` will be applied in the order of `Map` entries iteration, which is the order of entry insertion.
Comment on lines +135 to +137
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You are able to manipulate the `middlewareConfig` `Map` here as much as you want: delete entries, add entries, ... . Or construct a completely new Map. But keep in mind that you could easily mess up how the Wasp app works, as some of the middleware is expected and required. Check above for more info on each preset middleware.
Middleware from the `middlewareConfig` `Map` will be applied in the order of `Map` entries iteration, which is the order of entry insertion.
You can change the `middlewareConfig` object here as much as you want: delete entries, add entries or update entries. You can construct a completely new `middlewareConfig` object if you need to. Keep in mind that you could mess up how the Wasp app works, as some of the middleware is expected and required. Check above for more info on each default middleware.
Middleware from the `middlewareConfig` object will be applied in the order of `Map` entries iteration, which is the order of entry insertion.

I wanted to simplify the language a bit, take it or leave it :)


## 2. Customize `api`-specific Middleware

Expand Down
Loading