@wellenline/via
TypeScript icon, indicating that this package has built-in type declarations

2.6.4 • Public • Published

Via

Via

Simple, lightwieght & dependency free HTTP routing framework

Build Status

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,
});

Package Sidebar

Install

npm i @wellenline/via

Weekly Downloads

16

Version

2.6.4

License

MIT

Unpacked Size

67.8 kB

Total Files

36

Last publish

Collaborators

  • mihkelbaranov