docs: fix minor issues in middleware docs (#3436)
This commit is contained in:
@@ -39,7 +39,7 @@ excellent way to make http-related logic reusable on the server.
|
||||
Use the `define.middleware()` helper to get typings out of the box:
|
||||
|
||||
```ts middleware/my-middleware.ts
|
||||
import { define } from "./utils.ts";
|
||||
import { define } from "../utils.ts";
|
||||
|
||||
const middleware = define.middleware(async (ctx) => {
|
||||
console.log("my middleware");
|
||||
@@ -52,7 +52,7 @@ const middleware = define.middleware(async (ctx) => {
|
||||
Fresh ships with the following middlewares built-in:
|
||||
|
||||
- [cors()](/docs/plugins/cors) - Set CORS HTTP headers
|
||||
- [csrf()](/docs/plugins/cors) - Set CSRF HTTP headers
|
||||
- [csrf()](/docs/plugins/csrf) - Set CSRF HTTP headers
|
||||
- [trailingSlash()](/docs/plugins/trailing-slashes) - Enforce trailing slashes
|
||||
|
||||
## Filesystem-based middlewares
|
||||
@@ -60,8 +60,8 @@ Fresh ships with the following middlewares built-in:
|
||||
With file system based routing you can define a middleware in a `_middleware.ts`
|
||||
file inside the `routes/` folder or any of it's subfolders.
|
||||
|
||||
```ts routes/foo/_middleware.ts
|
||||
import { define } from "./utils.ts";
|
||||
```ts routes/_middleware.ts
|
||||
import { define } from "../utils.ts";
|
||||
|
||||
export default define.middleware(async (ctx) => {
|
||||
console.log("my middleware");
|
||||
@@ -71,8 +71,8 @@ export default define.middleware(async (ctx) => {
|
||||
|
||||
You can also export an array of middlewares:
|
||||
|
||||
```ts routes/foo/_middleware.ts
|
||||
import { define } from "./utils.ts";
|
||||
```ts routes/_middleware.ts
|
||||
import { define } from "../utils.ts";
|
||||
|
||||
const middleware1 = define.middleware(async (ctx) => {
|
||||
console.log("A");
|
||||
|
||||
Reference in New Issue
Block a user