compound icon indicating copy to clipboard operation
compound copied to clipboard

Question: migrate from compound to pure ExpressJS

Open nosuchip opened this issue 5 years ago • 3 comments

I want to remove compound from application due multiple issue with evaluation of controllers that seems isn't removable. I suppose compound internally pass req, res from ExpressJs to any action handler. Just one question remained - where is declaration of action so I able to import it to specific controller file to avoid breaking production code?

nosuchip avatar Jun 07 '19 18:06 nosuchip

You can use non-evaluated code to write your controllers, it is not recommended to use eval-style. Here's where action defined: https://github.com/1602/kontroller/blob/master/lib/flow-control.js#L209

1602 avatar Jun 13 '19 10:06 1602

@1602 thanks for response. Unfortunately it doesn't looks working (or I don't understand how to use it). action definition declared in kontroller but I cannot find how to import it into my controller after renaming it from some_controller.js to some.js (as I remember postfix _controller makes it evaluateable).

nosuchip avatar Jul 29 '19 22:07 nosuchip

if you rename some_controller.js to some.js it should indeed turn off eval mode and you will need to rewrite your controller to not use actionName(..., and use ControllerName.prototype.actionName = (c) => {} instead.

There's no need to use kontroller package directly, I only referred to it to answer to your question.

1602 avatar Jul 30 '19 11:07 1602