Skip to content
Koa Router in Typescript, Servlet-Like API
Branch: master
Clone or download
Latest commit 644ba06 Aug 14, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config init Jul 28, 2017
docs [ci skip] update doc, #11. need to work on better solutions. Aug 13, 2017
src
.editorconfig init Jul 28, 2017
.gitignore added test Aug 2, 2017
.npmignore added test Aug 2, 2017
.travis.yml fix travis config Aug 2, 2017
LICENSE.md added test Aug 2, 2017
README.md [ci skip] update doc, #11. need to work on better solutions. Aug 13, 2017
build.js init Jul 28, 2017
logger.yml adapt https Aug 4, 2017
package.json return this, #13 Aug 14, 2017

README.md

IMPORTANT !!

@t2ee/vader has now moved towards 1.x versions, with brand new mechanisms (though, 99% like apis as 0.x versions). For legacy 0.x versions, please see 0.x branch.

Introducation

@t2ee/vader is a routing component (with JAX-RS like grammars). It is to be used with koa@2.

For detailed introduction and examples, please visit vader.t2ee.org

Installation

npm i reflect-metadata @t2ee/core @t2ee/sl4js koa@2 @t2ee/vader -S

Example

import 'reflect-metadata';
import * as Koa from 'koa';
import {
    Path,
    Router,
    QueryParam,
    Response,
    GET,
} from '@t2ee/vader';

const router = Router.newInstance();

@Path('')
class Controller {

    @GET
    @Path('/say')
    say(@QueryParam('message') message: string) {
        const response = new Response();
        response.body = message;
        return response;
    }
}

router.use(Controller);
const app = new Koa();
app.use(router.routes());
app.listen(8080);
You can’t perform that action at this time.