docs: add _ prefix to unused requests params (#1007)
- add types to handlers in the Getting Started section to align with the examples in the Concepts section - prefix unused arguments with `_` as suggested by official VSCode plugin linting. --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ then adds a custom header to the response before returning it:
|
|||||||
import { Handlers } from "$fresh/server.ts";
|
import { Handlers } from "$fresh/server.ts";
|
||||||
|
|
||||||
export const handler: Handlers = {
|
export const handler: Handlers = {
|
||||||
async GET(req, ctx) {
|
async GET(_req, ctx) {
|
||||||
const resp = await ctx.render();
|
const resp = await ctx.render();
|
||||||
resp.headers.set("X-Custom-Header", "Hello");
|
resp.headers.set("X-Custom-Header", "Hello");
|
||||||
return resp;
|
return resp;
|
||||||
@@ -60,7 +60,7 @@ response:
|
|||||||
import { Handlers } from "$fresh/server.ts";
|
import { Handlers } from "$fresh/server.ts";
|
||||||
|
|
||||||
export const handler: Handlers = {
|
export const handler: Handlers = {
|
||||||
GET(req) {
|
GET(_req) {
|
||||||
const uuid = crypto.randomUUID();
|
const uuid = crypto.randomUUID();
|
||||||
return new Response(JSON.stringify(uuid), {
|
return new Response(JSON.stringify(uuid), {
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
|
|||||||
Reference in New Issue
Block a user