Skip to main content
version 1.0.0

REPL

Introduction

From Digital ocean article: A Read-Eval-Print Loop, or REPL, is a computer environment where user inputs are read and evaluated, and then the results are returned to the user. REPLs provide an interactive environment to explore tools available in specific environments or programming languages. Some examples include the Node.js console, IPython, the Bash shell, and the developer console found in most web browsers.

Athenna can easily integrate with node:repl package to run your entire infrastructure in parallel with the package.

Booting REPL

REPL allows you to interact with your entire Athenna application on the command line, including your models, jobs, events, and more. To enter the REPL environment, run the Artisan command:

node artisan repl

Importing modules

To import modules inside REPL you need to use dynamic imports:

{ Log } = await import('@athenna/logger') // Destructuring import
helpers = await import('#src/Helpers/index') // Default import
caution

If you don't use var/let/const in front of your importation, the variable will be set globally in your REPL session.

tip

You can check the global context of your REPL session running .ls. You can type .help to check all REPL commands available.