1.0.32 • Published 2 years ago

@kenote/express v1.0.32

Weekly downloads
8
License
MIT
Repository
github
Last release
2 years ago

@kenote/express

Using Express web framework to Kenote.js.

NPM Version NPM Downloads Gratipay

Usage

index.ts

import { Module, ServerFactory } from '@kenote/core'
import { ServiceEngine } from '@kenote/express'

@Module({
  imports: [],
  plugins: [],
  middlewares: [],
  httpException: {
    notFound: (ctx: Context) => {
      return ctx.status(404)
    },
    exception: (err: any, ctx: Context) => {
      ctx.renderException('error', { message: 'This page could internal server error' })
    }
  }
})
class AppModule {}

async bootstarp () {
  let factory = await ServerFactory(new ServiceEngine()).create(AppModule)
  factory.server.listen(4000)
}

MIT License.