1.0.3 • Published 8 years ago

madbet-middleware v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

Introduction

The middleware blueprint for Madbet, a super-lightweight and super-fast TypeScript middleware server framework for Node.js.

Installation

npm install --save madbet-middleware

Usage

import { MadbetMiddleware } from 'madbet-middleware'

export class MadbetStatic extends MadbetMiddleware {

  // `this.request` and `this.response` are available in this class
  // they come from the parameters of the function argument of the `createServer` function in the 'http' module

  // you can use the constructor to accept parameters
  constructor(private sampleParam: String) {
    super()
  }

  // override
  main(): void {
    // middleware code starts here
  }
  
}

Public API

abstract class MadbetMiddleware {
  request: IncomingMessage // from the built-in 'http' module
  response: ServerResponse // from the built-in 'http' module

  abstract main(): void
}

Credits

Kaleab S. Melkie (kaleabmelkie@gmail.com)

License

MIT License Copyright (c) 2017, Kaleab S. Melkie. All rights reserved.