0.0.20 • Published 1 year ago

@raccoons-co/nodejs-raccoonizer v0.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

nodejs-raccoonizer

CircleCI

A library for unified deploying of Nodejs microservices.

Simple. Minimal. Beautiful. © 2022 Raccoons. Developing a simple way to change.

Install library with

% npm install @raccoons-co/nodejs-raccoonizer

Implement YourKoaConfiguration.ts:

import { KoaMicroserviceFactory, KoaMicroservice } from "@raccoons-co/nodejs-raccoonizer";
import Koa from "koa";

export default class YourKoaConfiguration
  extends KoaMicroserviceFactory {

  public execute( microservice: KoaMicroservice ): void {
    microservice.application()
      .use(async ( ctx: Koa.Context ) => { ctx.body = "Hello World"; } );
  }
}
}

Implement your main EntryPoint.ts:

import { MicroserviceFactory } from "@raccoons-co/nodejs-raccoonizer";
import YourKoaConfiguration from "./YourKoaConfiguration";
import assert from "node:assert/strict";

try {
  assert( process.env.PORT, "Fails if PORT environment variable do not exist." );
  const atPort = Number( process.env.PORT );

  new MicroserviceFactory( new YourKoaConfiguration() )
    .microservice( atPort )
    .deploy();
} catch( exception ) {
    console.log( exception );
}

Run microservice with package.json script:

"scripts": {
    "build": "tsc",
    "prestart": "npm run test",
    "pretest": "npm run build",
    "start": "npm run this.microservice",
    "test": "echo ImplementYourTests",
    "this.microservice": "node dist/EntryPoint"
}

For more

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.0

1 year ago

0.0.1

1 year ago