repl

Interactive REPL for exploring and debugging.

Interface

await this.repl.start()

Returns

  • Promise that resolves when REPL session ends

Description

The repl service provides an interactive JavaScript environment with all Blognami services available. Start it via CLI for development and debugging.

Usage

npx blognami start-repl

Examples

Database Exploration

blognami > const db = await database
blognami > await db.users.count()
0

blognami > await db.users.insert({ name: 'Test', email: '[email protected]' })
blognami > await db.users.count()
1

Check Configuration

blognami > const cfg = await config
blognami > cfg.database
{ adapter: 'sqlite', database: 'my_app_development.db' }

Test Views

blognami > const html = await renderView('users/index', { users: [] })
blognami > console.log(html)

Project Info

blognami > const proj = await project
blognami > proj.name
'my-app'

blognami > await environment
'development'

Run Background Jobs

blognami > await runBackgroundJob('send-newsletter')

Features

  • All registered services available as variables
  • Full async/await support
  • Custom object inspection (__inspect methods)
  • VM context isolation

Notes

  • Development tool only, not for production
  • Exit with Ctrl+C or .exit
  • Services accessed same as in application code