Skip to content

Programmable API #249

Description

@v1rtl

Would be great to havea programmable API to use Klap for SSR apps.

something like this would be great:

import { App } from '@tinyhttp/app'
import { Bundler } from 'klap'

const isProd = process.env.NODE_ENV === 'production'

const app = new App()

const bundler = new Bundler({ source: 'index.html', dev: !isProd  })

app.use(bundler.middleware)

if (!isProd) {
  app.get('*', async (req, res) => {
    await bundler.bundle()
   
    res.sendFile('index.html')
 })
}

// ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions