version 1.0.0
Routing
Basic routing
The most basic Athenna console routes accept a command signature and a closure, providing a very simple and expressive method of defining routes and behavior without complicated routing configuration files:
import { Artisan } from '@athenna/artisan' // Artisan Facade
Artisan.command('hello', function () {
this.success('Hello from Athenna!')
})
Additional flags
The command
method from Artisan facade always returns the instance of commander
.
With this behavior you can set additional flags for your command when registering it. See the example:
import { Artisan } from '@athenna/artisan' // Artisan Facade
Artisan.command('hello', function (options) {
if (options.error) {
this.error('Hello from Athenna!')
return
}
this.success('Hello from Athenna!')
})
.description('Athenna says hello.')
.option('--no-error', 'Log with error helper instead of success.', false)
.createHelp()
Listing commands
The node artisan
command can easily provide an overview of all the commands that are defined by your application:
node artisan
You can list in a more detailed way the subcommands:
node artisan list make
node artisan list route