@101-ways/core-express
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@101-ways/core-express

Express server accelerator package. It uses the Service Registry pattern to create a single object with APIs.

Features

  • starts server on port 8000 by default
  • request / response logging with tracing metadata
  • asynchronous context within request flow

Usage

import { load } from '@101-ways/core-express';

load([`${__dirname}/modules`]).then((sr) => {
  sr.express.app.get('/hello', (req, res) => {
    res.json({ result: 'hello world' });
  });
});

Basic example for creating a child package:

import { load as loadCore, type Registry } from '@101-ways/express';

export type { Registry };

export async function load<T extends Registry>(paths: string[] = [], sr?: T) {
  return loadCore([`${__dirname}/modules`, ...paths], sr);
}

Service Registry API

Everything in @101-ways/core and

Environment Variables

Everything in @101-ways/core and

  • PORT='8000' - HTTP server port

Readme

Keywords

none

Package Sidebar

Install

npm i @101-ways/core-express

Weekly Downloads

1

Version

0.1.0

License

none

Unpacked Size

21.9 kB

Total Files

38

Last publish

Collaborators

  • borisovg