Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including kamboja with all npm packages installed. Try it out:

var kamboja = require("kamboja")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

kamboja v0.4.0

MVC Framework powered by TypeScript


Gitter npm version Build Status Coverage Status Known Vulnerabilities

KambojaJS aims to fix some problems occurs when using the old guy, like increase testability, add convention over configuration and use modern language feature like async/await decorator etc, read more

Convention Over Configuration

KambojaJS route generation system generate url using pattern below:


Example you define controller like below

import { Controller } from "kamboja"

export namespace Api.v01
  export class UserController extends Controller {
    list(query:string, offset:number, limit:number){ }

Above code by default will generate a GET url below


Refer to controller reference for more information

For more advanced use, KambojaJS provide a convention for creating Restful API by using ApiController

Example controller below will create Restful API url for you

import { ApiController } from "kamboja"

namespace Api.V1 {
    export class ItemsController extends ApiController {
        //GET /api/v1/items/:id
        get(id:string) { }
        //GET /api/v1/items?offset=1&limit=<optional>
        list(offset:number, limit=50){ }
        //POST /api/v1/items
        add(data){ }
        //DELETE /api/v1/items/:id
        delete(id:string){ }
        //PUT /api/v1/items/:id
        replace(id:string, data){ }
        //PATCH /api/v1/items/:id
        modify(id:string, data){}

Above code will generate some urls:

GET     /api/v1/items/:id
GET     /api/v1/items?offset=1&limit=<optional>
POST    /api/v1/items
DELETE  /api/v1/items/:id
PUT     /api/v1/items/:id
PATCH   /api/v1/items/:id

Refer to ApiController for more information


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free