Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: migrate from compound to pure ExpressJS #655

Open
nosuchip opened this issue Jun 7, 2019 · 3 comments
Open

Question: migrate from compound to pure ExpressJS #655

nosuchip opened this issue Jun 7, 2019 · 3 comments

Comments

@nosuchip
Copy link

nosuchip commented Jun 7, 2019

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?

@1602
Copy link
Owner

1602 commented Jun 13, 2019

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

@nosuchip
Copy link
Author

@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).

@1602
Copy link
Owner

1602 commented Jul 30, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants