think-controller
May 17, 2026 ยท View on GitHub
This repository has been migrated. For ongoing updates, please see https://github.com/thinkjs/thinkjs/tree/master/packages/think-controller.
think-controller
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 foundemptyController{String} default controller when not foundpreSetStatus{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. whenpreSetStatusis set and action exist, it's will preset status before action invoked.