1import { App, staticFiles } from "fresh";2import { define, type State } from "./utils.ts";34export const app = new App<State>();56app.use(staticFiles());78// Pass a shared value from a middleware9app.use(async (ctx) => {10 ctx.state.shared = "hello";11 return await ctx.next();12});1314// this is the same as the /api/:name route defined via a file. feel free to delete this!15app.get("/api2/:name", (ctx) => {16 const name = ctx.params.name;17 return new Response(18 `Hello, ${name.charAt(0).toUpperCase() + name.slice(1)}!`,19 );20});2122// this can also be defined via a file. feel free to delete this!23const exampleLoggerMiddleware = define.middleware((ctx) => {24 console.log(`${ctx.req.method} ${ctx.req.url}`);25 return ctx.next();26});27app.use(exampleLoggerMiddleware);2829// Include file-system based routes here30app.fsRoutes();