Update example-logged-in-user.mdx (#6780)

Add authenticate() middleware to be able to get current user with req.user
This commit is contained in:
Deveosys
2024-03-22 09:44:13 +01:00
committed by GitHub
parent b792c4cab5
commit 8929b2d60b

View File

@@ -24,6 +24,7 @@ Create the file `src/api/middlewares.ts` with the following content:
```ts title="src/api/middlewares.ts" ```ts title="src/api/middlewares.ts"
import type { import type {
authenticate,
MiddlewaresConfig, MiddlewaresConfig,
User, User,
UserService, UserService,
@@ -60,7 +61,7 @@ export const config: MiddlewaresConfig = {
routes: [ routes: [
{ {
matcher: "/admin/products", matcher: "/admin/products",
middlewares: [registerLoggedInUser], middlewares: [authenticate(), registerLoggedInUser],
}, },
], ],
} }