Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@mapl/web

mapljs1.3kMIT0.3.12TypeScript support: included

A compiled web framework for all runtimes

fast, lightweight, cross-runtime, framework, web, backend

readme

A compiled web framework for all runtimes.

import { router, handle, layer } from '@mapl/web';
import { compileToHandler } from '@mapl/web/compiler/jit';

const api = router([], [
  handle.get('/', () => 'Hi')
]);

const app = router(
  // Middlewares
  [ layer.attach('id', () => performance.now()) ],

  // Routes
  [
    handle.get('/path', (c) => '' + c.id, {
      // Response wrapper
      type: handle.text
    })
  ],

  // Subrouters
  { '/api': api }
);

export default {
  fetch: await compileToHandler(app)
};

AOT compilation (experimental)

Build @mapl/web to improve startup time.

Rolldown

Try it out using:

npm install -g degit
degit github:mapljs/web/examples/generic
# or with Bun
degit github:mapljs/web/examples/bun