Modern

KambojaJS powered by TypeScript so you can use modern javascript feature like async, await or decorator.

import { ApiController } from "kamboja"
import { model } from "moringa"
import { CustomerModel } from "../model"

export namespace V1 {
    export class CustomersController extends ApiController {
        //GET /v1/customers?offset=1&limit=<optional>
        async list(offset:number, limit = 50){
            let CustomerOdm = model<CustomerModel>("Customer")
            let [count, result] = await Promise.all([
                CustomerOdm.find().count().exec(),
                CustomerOdm.find().limit(limit).skip(offset)
            ])
            return {
                total: count,
                result: result
            }
        }
    }
}

Above code showing concurrent process to get a paginated data which require 2 processes (calculate total data and getting the data). Even KambojaJS can send response status 500 if one of each code throwing error.

TypeScript added static checking ability to current JavScript so it can provide great tooling like autocomplete, refactoring etc. Many great tools already there for you to choose like: VSCode, Atom, WebStorm