Docs
Routing
Customizing Response
Customizing Response
prewrite
helps you customize res.send
.
WARNING
res.end doesn't supportusePrewrite
. Use res.send instead.#Examples
It can be used directly in page files, and can also be used in middleware and plugins.
Typescript
import { usePrewrite } from 'zely';
export function get(ctx) {
usePrewrite(ctx.response, (data) => {
return `I love ${data}`;
});
res.send('cat'); // I love cat
}