npm.io
4.0.14 • Published 7 years ago

the-controller-base

Licence
MIT
Version
4.0.14
Deps
6
Size
60 kB
Vulns
0
Weekly
116
DeprecatedThis package is deprecated

the-controller-base

Build Status npm Version JS Standard

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.

Keywords