I have a problem.
My middleware doesn't get executed...
This is my code:
我有个问题。我的中间件没有被执行...这是我的代码:
export const config = {
matcher: '/api/:function*',
};
This is the config I gave, it should only execute when the API gets a request.
I have the middleware.ts file inside my app/ folder.
Does someone know why this isn't working. I have the app routing version without the src/ folder selected.
这是我提供的配置,它应该只在API收到请求时执行。我的应用程序/文件夹中有midleware.ts文件。有没有人知道为什么这不管用。我有没有选择src/文件夹的应用程序路由版本。
更多回答
优秀答案推荐
Place middleware.ts
in the src/
directory. It should be on the same level as app
directory.
将midleware.ts放在src/目录中。它应该在同一级别的应用程序目录。
更多回答
I love you <3 Nextjs made a very bad documentation. I though it would work by just putting it into the app folder.
我爱你<3 Nextjs做了一个非常糟糕的文档。我以为只要把它放到应用程序文件夹里就行了。
我是一名优秀的程序员,十分优秀!