Fresh logo
🚧 This documentation is work in progress and for an unreleased version of Fresh.

Plugins

Fresh itself can be extended through the methods available on the App class or on the Builder class. Most of the features in Fresh itself are built using these APIs.

Custom middlewares

If you need to modify requests, add HTTP headers or pass additional data to other middlewares via ctx.state, then going with a middleware is the way to go.

Typescript middleware/fresh.ts
const addXFreshHeader = define.middleware(async (ctx) => {
  const res = await ctx.next();
  res.headers.set("X-Fresh", "served by Fresh");
  return res;
});

Learn more about middlewares.

TODO: Show more ways