Skip to content

mapljs/app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mapl

A low-overhead framework for all runtimes.

import { jitc, router } from '@mapl/app';

// Declare sub routers
const subroute = router()
  // Example middleware
  .use((c) => c.headers.push(['access-control-allow-origin', '*']))

  // Send html
  .get('/example', {
    type: 'html',
    fn: () => '<a href="https://example.com">example.com</a>'
  });

const app = router()
  // Send normal text
  .get('/', () => 'Hi')

  // Send JSON
  .get('/req', {
    type: 'json',
    fn: (ctx) => ctx
  })

  // Set subroutes
  .route('/api', subroute);

// Compile the app
const buildResult = await jitc(app);

// Example request
buildResult.fetch(new Request('http://127.0.0.1:3000')); // new Response('Hi')

About

A low overhead Web Standard framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published