0.1.3 • Published 2 years ago

nanium-channel-express-rest v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

nanium-channel-express-rest

A nanium request channel based on express using multiple REST-style endpoints.

Install

npm install nanium-channel-express-rest

Usage

import { Nanium } from 'nanium/core';
import { NaniumExpressHttpChannel } from 'nanium-channel-express-rest';
import * as express from 'express';

const expressApp: express.Express = express(); 
  
await Nanium.addManager(new NaniumNodejsProvider({
  requestChannels: [
    new NaniumExpressHttpChannel({
      apiPath: '/api',
      server: expressApp,
      executionContextConstructor: Object
    })
  ]
}));

Creates a HTTP endpoint for each service based on the service name.

Which HTTP method is used depends on the name of the contract.ts file;

GET:

  • get.contract.ts
  • query.contract.ts

PUT:

  • update.contract.ts
  • change.contract.ts
  • store.contract.ts
  • put.contract.ts

DELETE:

  • remove.contract.ts
  • delete.contract.ts

POST:

  • create.contract.ts
  • add.contract.ts
  • post.contract.ts
  • everything else
0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago