Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.47 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.47 KB

decorated-uws

Small decorator based framework based on UWS.js This project is currently in alpha stages. NOT READY for production use

Idea

Main goal of the project is to create modern wrapper on UWS.js library in order to achieve easy to use, yet fast framework. Decorators are inspired by similar projects like routing-controllers and Nest. Moreover, Fastify inspired optional optimizations are planned. UWS.js provides also support for web socket communication, custom decorators that would add support are planned.

Current stage

At this moment this library provides only very basic functionality.

Usage

index.ts

import { App } from 'decorated-uws';
import { TestController } from './controller';

const app = new App({ controllers: [TestController] });
app.listen(3000);

controller.ts

import { Controller, Get } from 'decorated-uws';
@Controller('/')
class TestController {
  @Get('/')
  public get() {
    return { hello: 'world' };
  }
}

App options

controllers: Controller[]: array of controllers decorated with Controller decorator key?: string: filename of key file to use SSL cert?: string: filename of cert file to use SSL passphrase?: string: password for SSL key defaultBodyParser?: (data: Buffer) => any: default request body parser, if none given, app will try to parse body as JSON