0.4.2 • Published 3 years ago

@keawade/framethework v0.4.2

Weekly downloads
103
License
MIT
Repository
github
Last release
3 years ago

Framethework

GitHub Workflow Status GitHub

Framethework is a microservices framework built on top of NATS.

Using Framethework requires a NATS server. All examples assume a NATS server is already running unless otherwise specified.

Usage

This basic example shows how to create a small math service to add two numbers and call it locally.

import { action, Broker, Service } from '@keawade/framethework';

// Write a service
class MathService extends Service {
  public name = 'math';

  @action()
  public add(params: { a: number, b: number }): number {
    return params.a + params.b;
  }
}

// Create a broker
const broker = new Broker();

// Register your service(s) with the broker
broker.registerService(MathService);

// Start the broker
broker.start()
  // Call the service
  .then(() => broker.call('math.add', { a: 5, b: 3 }))
  // Print the response
  .then(res => console.log('5 + 3 =', res))
  .catch(err => console.error(`Error occurred! ${err.message}`));

framethework-runner

Framethework Runner is a utility that helps you run Framethework services. With it you don't need to create a Broker instance. Instead you can simply call the framethework-runner with paths to your service class files and it will automatically create a broker and load your services.

framethework-runner ./path/to/MyService.js

Check out the examples/ directory for some example services.

Things I want to implement

  • Middlewares
  • Not found errors
  • API gateway
  • Action JSON schema param validation
  • OpenAPI docs generation from action params
0.4.2-alpha.46

3 years ago

0.4.2

3 years ago

0.4.2-alpha.47

3 years ago

0.4.1

3 years ago

0.4.0-alpha.41

3 years ago

0.4.0

3 years ago

0.4.0-alpha.40

3 years ago

0.4.0-alpha.39

3 years ago

0.4.0-alpha.38

3 years ago

0.4.0-alpha.37

3 years ago

0.4.0-alpha.36

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.2.0-alpha.32

3 years ago

0.1.1

3 years ago

0.1.1-alpha.28

3 years ago

0.2.0-alpha.30

3 years ago

0.1.1-alpha.25

3 years ago

0.1.1-alpha.23

3 years ago

0.1.0

3 years ago