@restorecommerce/facade
TypeScript icon, indicating that this package has built-in type declarations

2.2.9 • Public • Published

@restorecommerce/facade

import { createLogger } from '@restorecommerce/logger';
import { createFacade } from '@restorecommerce/facade';
import { exampleModule } from './example-module';

const logger = createLogger(cfg.logger);
const env = process.env.NODE_ENV;

const facade = createFacade({
  port: 5000,
  logger,
  env
}).useModule(exampleModule, { message: 'foo' });

facade.start();

Included 3rd party koa middlewares

Provided koa middlewares

Metadata Passing

The facade packages and sends upstream all headers as well as the origin address in the GRPC metadata.

The headers are in a JSON serialized format.

Example:

Metadata({
  'headers': [
      '{"host":"192.168.1.103:5000","user-agent":"Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0","accept":"*/*","accept-language":"en-US,en;q=0.5","accept-encoding":"gzip, deflate","referer":"http://192.168.1.103:5000/graphql","content-type":"application/json","content-length":"540","origin":"http://192.168.1.103:5000","connection":"keep-alive"}'
  ],
  'origin-ip': [ '192.168.1.103' ]
})

Readme

Keywords

Package Sidebar

Install

npm i @restorecommerce/facade

Weekly Downloads

23

Version

2.2.9

License

MIT

Unpacked Size

3.53 MB

Total Files

559

Last publish

Collaborators

  • vanthome
  • akumarnpm
  • dani723
  • vilsol
  • radu1990