Servax
Servax is a framework for building server side web applications in TypeScript and makes use of Experimental Decorators.
Servax focuses on the ability to structure and implement application code and leaves the underling both HTTP communication and view templating to other more specialist libraries, e.g. ExpressJS and Nunjucks.
Installation
Install using NPM
npm i servax
Install a HTTP Host e.g.
npm i servax.express
Install a View Renderer e.g.
npm i servax.nunjucks
Usage
;httpServer .setHttpHostnew ExpressHttpHost .setViewRenderernew NunjucksViewRenderer, as IViewRendererOptions .registerServices .registerControllers .start as IHttpHostOptions;
Routing
Routing can be applied at Controller Level or Verb Level. Controller and Verb routes are combined, e.g.
Supported Verbs:
GET
POST
PUT
DELETE
PATCH
OPTIONS
ALL
Built-in Response Types
TextResponse
HtmlResponse
ViewResponse < Requires Registering a View Resolver such as servax.nunjucks
Dependency Lifetimes
DependencyLifespan.PerRequest; // Recreated for every server request that needs itDependencyLifespan.ApplicationLifetime; // Created once and reused