Skip to content

Programmable API #249

Open
Open
@talentlessguy

Description

@talentlessguy

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')
 })
}

// ...

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