@the-/controller

Base of the-controllers

@the-/controller

Base of the-controllers

Installation

$ npm install @the-/controller --save

Usage

'use strict'

const { TheCtrl } = require('@the-/controller')
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 {} = this
      /* ... */
    }
  }

  server.register(FruitShopCtrl, 'fruitShop')

  server.listen(3000)
}

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

API Guide

function

License

This software is released under the MIT License.

Links

HomePage

https://github.com/the-labo/the/tree/master/packages/controller#readme

Repository

the-labo/the