0.1.1 • Published 2 years ago

@nedvisol/hexagon-core v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Overview

This core package defines the decorators used by the library, to annotate Typescript classes for RESTful web services mapping.

See full documentation

The motivation behind this library is to help make your Node microservice code more portable, between web frameworks (such as Express or Koa) or Serverless model with cloud functions. We believe in the Hexagonal architecture where your core business logic should be loosely-coupled with the presentation interface and the underlying services.

Example

Install Hexagon via NPM

$ npm install @nedvisol/hexagon-core

Write your first controller by creating a plain-old Typescript class and annotate

// index.ts
import { RestController, RestGetMapping, RestPathParam } from '@nedvisol/hexagon-core';
@RestController()
export class UserController {  
 
  @RestGetMapping('/users/:id')
  getUser (@RestPathParam('id') id: string): IUser {
    return { id, name: 'test' };
  }
}