think-controller

1.0.5 • Public • Published

think-controller

Build Status Coverage Status npm devDependency Status

Invoke controller for ThinkJS 3.x

How To Use

Modify src/config/middleware.js:

const controller = require('think-controller');

module.exports = [
  {
    handle: controller,
    options: {
      emptyModule: '',
      emptyController: '',
      preSetStatus: 200
    }
  }
];

Options

  • emptyModule {String} default module when not found
  • emptyController {String} default controller when not found
  • preSetStatus {Number} preset http status when action exist Koa set http status to 404 before request handling, and will changed when set body or status properties. when preSetStatus is set and action exist, it's will preset status before action invoked.

Readme

Keywords

none

Package Sidebar

Install

npm i think-controller

Weekly Downloads

785

Version

1.0.5

License

none

Unpacked Size

10.1 kB

Total Files

7

Last publish

Collaborators

  • lizheming
  • welefen
  • sijiecai
  • lushijie
  • berwin
  • bezos
  • toxicjohann
  • huangxiaolu