Hexagon is a tool to help you build portable node micro/nano-services to be deployed as a service or cloud functions. Hexagon
Overview
This core package defines the decorators used by the library, to annotate Typescript classes for RESTful web services mapping.
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' };
}
}