Application
The Application class is the main entry point for a Vercube application. It manages the application lifecycle, including initialization, routing, and listening for incoming requests.
Overview
The Application class provides the following functionality:
- Application Lifecycle - Managing the application lifecycle, including initialization, startup, and shutdown
- Routing - Defining and handling routes
- Middleware - Adding middleware to the application
- Error Handling - Configuring error handlers
- Configuration - Managing application configuration
Creating an Application
You can create an application using the createApp
function:
typescript
import { createApp } from '@vercube/core';
import { Container } from '@vercube/di';
// Create a container
const container = new Container();
// Create an application
const app = createApp({
server: {
port: 3000,
host: 'localhost'
}
});
Application Options
The createApp
function accepts the ConfigTypes.Config