Dependency injection
A container creates your components, providers, modules and controllers, manages their lifetimes and validates their options. Construction is asynchronous, so an object can connect or load before it is used.
An IoC framework for TypeScript. Web services, CLI tools, desktop and embedded applications share the same objects, validation and controllers.
npx @lakutata/cli create --name my-appOr add the framework to a project:
npm install lakutata expressimport {Application} from 'lakutata'
import {buildEntrypoints, Controller} from 'lakutata/com/entrypoint'
import {GET} from 'lakutata/decorator/ctrl'
import {expressHTTPEntrypoint} from 'lakutata/adapter/express'
class HelloController extends Controller {
@GET('/hello')
public async hello(): Promise<string> {
return 'Hello, Lakutata'
}
}
Application.run(() => ({
id: 'hello.app',
name: 'Hello',
components: {
entrypoint: buildEntrypoints({
controllers: [HelloController],
//GET http://127.0.0.1:3000/hello
http: expressHTTPEntrypoint({port: 3000})
})
},
bootstrap: ['entrypoint']
}))Getting Started creates a first project; the Overview introduces the concepts, and each guide then covers one part of the framework.