@@ -39,7 +39,7 @@ excellent way to make http-related logic reusable on the server.
3939Use the ` define.middleware() ` helper to get typings out of the box:
4040
4141``` ts middleware/my-middleware.ts
42- import { define } from " ./utils.ts" ;
42+ import { define } from " .. /utils.ts" ;
4343
4444const middleware = define .middleware (async (ctx ) => {
4545 console .log (" my middleware" );
@@ -52,16 +52,16 @@ const middleware = define.middleware(async (ctx) => {
5252Fresh ships with the following middlewares built-in:
5353
5454- [ cors()] ( /docs/plugins/cors ) - Set CORS HTTP headers
55- - [ csrf()] ( /docs/plugins/cors ) - Set CSRF HTTP headers
55+ - [ csrf()] ( /docs/plugins/csrf ) - Set CSRF HTTP headers
5656- [ trailingSlash()] ( /docs/plugins/trailing-slashes ) - Enforce trailing slashes
5757
5858## Filesystem-based middlewares
5959
6060With file system based routing you can define a middleware in a ` _middleware.ts `
6161file inside the ` routes/ ` folder or any of it's subfolders.
6262
63- ``` ts routes/foo/ _middleware.ts
64- import { define } from " ./utils.ts" ;
63+ ``` ts routes/_middleware.ts
64+ import { define } from " .. /utils.ts" ;
6565
6666export default define .middleware (async (ctx ) => {
6767 console .log (" my middleware" );
@@ -71,8 +71,8 @@ export default define.middleware(async (ctx) => {
7171
7272You can also export an array of middlewares:
7373
74- ``` ts routes/foo/ _middleware.ts
75- import { define } from " ./utils.ts" ;
74+ ``` ts routes/_middleware.ts
75+ import { define } from " .. /utils.ts" ;
7676
7777const middleware1 = define .middleware (async (ctx ) => {
7878 console .log (" A" );
0 commit comments