docs: Remove references to deprecated types (#2125)
As per the [1.6 release](https://deno.com/blog/fresh-1.6#simplified-typings), and commentary by @csvn [here](https://github.com/denoland/fresh/issues/2108#issuecomment-1836625789), this PR aims to replace the references to deprecated typing in the documentation. Please see inline commentary for parts I'm unclear on.
This commit is contained in:
@@ -16,9 +16,9 @@ requests. You can CORS enable all the routes affected by some `middleware` by
|
||||
doing the following:
|
||||
|
||||
```ts routes/_middleware.ts
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
|
||||
export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
|
||||
export async function handler(req: Request, ctx: FreshContext) {
|
||||
const origin = req.headers.get("Origin") || "*";
|
||||
const resp = await ctx.next();
|
||||
const headers = resp.headers;
|
||||
@@ -45,9 +45,9 @@ deal with "preflight requests". Let's imagine you're trying to support a
|
||||
`DELETE` route. Then you'd need to do something like this:
|
||||
|
||||
```ts routes/_middleware.ts
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
import { FreshContext } from "$fresh/server.ts";
|
||||
|
||||
export async function handler(_req: Request, ctx: MiddlewareHandlerContext) {
|
||||
export async function handler(_req: Request, ctx: FreshContext) {
|
||||
if (_req.method == "OPTIONS") {
|
||||
const resp = new Response(null, {
|
||||
status: 204,
|
||||
|
||||
Reference in New Issue
Block a user