@wellenline/via
v2.6.4
Published
Lightweight express like web framework
Downloads
45
Maintainers
Readme
Via
Simple, lightwieght & dependency free HTTP routing framework
Installation
$ npm add @wellenline/via
Basic Example
import { bootstrap, Resource, Get, app } from "@wellenline/via";
@Resource()
export class Hello {
@Get("/hello")
public async index() {
return {
hello: "world"
};
}
}
bootstrap({
port: 3000,
});
Examples
Hooks (middleware)
@Before((context: IContext) => void)
import { bootstrap, Resource, Get, app, IContext } from "@wellenline/via";
@Resource("/path", { version: "v1" })
export class Hello {
@Get("/hello/:hello")
@Before(async (context: IContext) => {
return context.params.hello === "world"; // continue if hello === world
);
public async index() {
return {
hello: "world"
};
}
}
bootstrap({
port: 3000,
});