Skip to content
On this page

v2.0

v2.0 may not be currently stable.

Visit blog

Changes

  1. snatcher

A snatcher, like fetch, carries data between pages.

However, it does not use http, such as fetch, but receives data directly from the file that corresponds to the page.

ts
import { snatcher } from 'prext';

export async function get(req, res) {
  const snatch = snatcher(req, res);
  const { body } = await snatch('/user');

  res.send(`users: ${body}`);
}
ts
export function get(req, res) {
  res.json({ cat: '🐱' });
}

Example: /playground/snatcher

  1. public directory

Before, you had to set up a public directory with an external library, such as serve.. But you don't have to do that anymore!

ts
export default defineConfig({
  public: '/public/',
});