the-controller-base

Base of the-controllers

the-controller-base

Base of the-controllers

Installation

$ npm install the-controller-base --save

Usage

'use strict'

const { TheCtrl } = require('the-controller-base')
const theServer = require('the-server')

async function tryExample () {
  // Create server instance
  const server = theServer({ /* ... */ })

  class FruitShopCtrl extends TheCtrl {
    async buy (name, amount = 1) {
       // Controller instance will be created per client
      const { client, app } = this
      /* ... */
    }
  }

  server.register(FruitShopCtrl, 'fruitShop')

  server.listen(3000)
}

tryExample().catch((err) => console.error(err))

API Guide

License

This software is released under the MIT License.

Links

HomePage

https://github.com/the-labo/the-controller-base#readme

Repository

the-labo/the-controller-base