Application embedding / Reusing helpers or database connectors in standalone files #101
Replies: 1 comment 1 reply
-
Application embedding became a thing in Mojolicious mostly because of tests. That's not really needed with mojo.js because using ESM exports is so easy. For cronjob scripts i tend to use application specific commands in both frameworks. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
coming from Perl, I'm really interested in the speed and in-built async support of mojo.js. However, my architecture relies on heavily using standalone scripts (e.g. for cronjobs) that are reusing the config files, helpers and database connectors.
The Perl Mojolicious docs are describing this as Application embedding. (https://docs.mojolicious.org/Mojolicious/Guides/Cookbook#Application-embedding).
For mojo.js, it seems there is just an easy way to reuse config files (https://mojojs.org/docs/Cookbook.md#adding-a-configuration-file), but I can't really find anything about reusing other parts of a main app without importing everything again.
Is there a trick to do this? Thanks in advance for any suggestions!
Beta Was this translation helpful? Give feedback.
All reactions