0.0.20 • Published 3 years ago

@raccoons-co/nodejs-raccoonizer v0.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years 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

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.0

3 years ago

0.0.1

3 years ago