Package Exports
- @kites/engine
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kites/engine) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
kites-engine
Core Engine of Kites
Kites is a framework providing dynamic applications assembling and API routing. It contains a lot of templates and extensions help build up applications quickly.
Extensions auto discovery
Kites by default auto discovers extensions in the application's directory tree. This means kites by default searches for files kites.config.js which describes the extensions and applies all the extensions that are found. You have a short code, but powerful!
TypeScript version:
// let kites autodiscover the extensions
import engine from '@kites/engine';
async function bootstrap() {
const app = await engine().init();
app.logger.info('A new kites engine started!');
}
bootstrap();Node/JavaScript version:
// let kites autodiscover the extensions
const engine = require('@kites/engine');
// init the kites engine
engine().init().then((app) => {
app.logger.info('A new kites engine started!')
})Kites extensions auto discovery might slows down the startup and can be explicitly override by using use function. The following code snippet is more complex a bit.
import engine from '@kites/engine';
import express from '@kites/express';
import roomrtc from '@kites/roomrtc';
async function bootstrap() {
const app = await engine({
discover: false, // do not let kites autodiscover the extensions
extensionsLocationCache: false, // do not load extensions from locations cache
logger: {
console: {
transport: 'console',
level: 'debug'
}
})
.use(express())
.use(roomrtc())
.init();
app.logger.info('A new kites engine started!');
}
bootstrap();Extensions
You are welcome to write your own extension or even publish it to the community.
TODO:
- Write an article for implementing custom kites extension
Logging
kites leverages winston 2 logging abstraction together with debug utility. To output logs in the console just simply set the DEBUG environment variable
DEBUG=kites node app.json windows:
set DEBUG=kites & node app.jskites exposes logger property which can be used to adapt the logging as you like. You can for example just add winston console transport and filter in only important log messages into console.
import engine from '@kites/engine';
import winston from 'winston';
const app = engine();
app.logger.add(winston.transports.Console, { level: 'info' });