Basics Tutorial
Overview
Section titled “Overview”This tutorial will guide you through the basic features, perfect for beginners.
Learning Objectives
Section titled “Learning Objectives”After completing this tutorial, you will be able to:
- Create and configure application instances
- Understand the basic lifecycle
- Handle common use cases
Step 1: Create an Application
Section titled “Step 1: Create an Application”First, let’s create a basic application:
import { createApp } from 'your-package-name';
const app = createApp({ name: 'Tutorial App', debug: true});Step 2: Configure Options
Section titled “Step 2: Configure Options”You can customize various options:
const app = createApp({ name: 'Tutorial App', version: '1.0.0', debug: true, timeout: 10000});Configuration Explained
Section titled “Configuration Explained”name- Application name for logging and identificationversion- Version number, optionaldebug- Enable debug outputtimeout- Operation timeout in milliseconds
Step 3: Run the Application
Section titled “Step 3: Run the Application”Starting the application is simple:
await app.run();console.log('Application started!');Step 4: Stop the Application
Section titled “Step 4: Stop the Application”When you need to stop:
await app.stop();console.log('Application stopped');Complete Example
Section titled “Complete Example”Putting it all together:
import { createApp } from 'your-package-name';
async function main() { const app = createApp({ name: 'Tutorial App', debug: true });
try { await app.run(); console.log('Application running...');
// Do some work await new Promise(resolve => setTimeout(resolve, 5000));
await app.stop(); console.log('Application stopped'); } catch (error) { console.error('Error:', error); }}
main();Exercises
Section titled “Exercises”Try these exercises to reinforce your learning:
- Create an app with a 30-second timeout
- Enable debug mode and observe the output
- Add error handling logic
Next Steps
Section titled “Next Steps”- Advanced Tutorial - Learn advanced features
- API Documentation - View complete API reference