0.1.0 • Published 9 months ago

koa-webc v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

The KoaWebC plugin

build status npm version

This plugin enables Koa to serve WebC pages.

Installing

npm i koa-webc

Basic usage

import Koa from "koa"
import { KoaWebC } from "koa-webc"

const app = new Koa()
app.use(KoaWebC())

app.use(async ctx => ctx.render("hello-world.webc"))

app.listen(3000)
console.log("http://localhost:3000")

Using with other middlewares

const app = new Koa()
const router = new Router()

router.get("/the-extras", async ctx => {
  // override data options
  await ctx.render("the-extras.webc", {data: {bar: 'baz', xpto: "xpto"}})
})

// middleware registration order is important
app
  .use(KoaWebC({
    bundle: true,
    viewPath: path.join(process.cwd(), "test", "fixtures"),
    data: {
      foo: "foo",
      bar: "bar"
    }
  }))
  .use(router.routes())
  .use(router.allowedMethods())
  .listen(3000)
console.log("http://localhost:3000")

See more examples

Roadmap

  • initial support
  • npm package publishing
  • dedicated example project with snippets
  • check interaction with other middlewares
  • documentation once api gets stable
  • performance/benchmark tests
  • CI/CD to automatically publish on npm
0.1.0

9 months ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago