# mediacentral-service-rest-bridge-toolkit

> Toolkit to generate platfrom facades for REST services

Latest version **1.0.4** (published 2018-06-28) · SEE LICENSE IN EULA.md license · 0 weekly downloads

## Install

```sh
npm install mediacentral-service-rest-bridge-toolkit
pnpm add mediacentral-service-rest-bridge-toolkit
yarn add mediacentral-service-rest-bridge-toolkit
bun add mediacentral-service-rest-bridge-toolkit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-06-28 |
| First published | 2018-04-17 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN EULA.md |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 149.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | andre.milton, artur.ziemba.avid, joeapearson, manodupont, michal.oleszczuk.avid, tomasz.moryl.avid, wbauer |

## Links

- npm: https://www.npmjs.com/package/mediacentral-service-rest-bridge-toolkit
- Repository: git@git.devops-int.avid.com:incubator/rest-bridge-toolkit
- npm.io page: https://npm.io/package/mediacentral-service-rest-bridge-toolkit

## Dependencies (6)

- [ejs](https://npm.io/package/ejs.md) *
- [yargs](https://npm.io/package/yargs.md) 10.0.3
- [bluebird](https://npm.io/package/bluebird.md) *
- [esformatter](https://npm.io/package/esformatter.md) ^0.10.0
- [raml-1-parser](https://npm.io/package/raml-1-parser.md) ^1.1.35
- [array-includes](https://npm.io/package/array-includes.md) ^3.0.3

## Recent versions

- 1.0.4 (latest) — 2018-06-28
- 1.0.3 — 2018-04-24
- 1.0.21 — 2018-04-23
- 1.0.2 — 2018-04-17

## README

## Mediacentral service rest bridge toolkit
Generates platform bridge service that acts as a facade for external REST service

## Motivation:
1. Expose external REST service into the platform
2. Controll the access to the API via secure gateway
3. ACL vi IAM

## Install the package

Install the service rest bridge toolkit from [npmjs](https://www.npmjs.com/package/mediacentral-service-rest-bridge-toolkit)

    npm i -g mediacentral-service-rest-bridge-toolkit

## Usage

### Step 1 - Create or obtain the RAML file for your RESTful service

Create [RAML](https://raml.org) definition for your API.

See examples in *./RamlSamples* folder.

### Step 2 - generate your service

To see the generatr usage help run it without parameters

    mediacentral-service-rest-bridge-toolkit

or 

    mediacentral-service-rest-bridge-toolkit --help

To generate the service provide the path to the RAML file and output folder

    mediacentral-service-rest-bridge-toolkit -r ./NetflixConductor.raml -o ./netflix-confuctor

To generate the service exposed via upstream specify the option

    mediacentral-service-rest-bridge-toolkit -r ../NetflixConductor.raml -o ./netflix-confuctor -u true

### Step 4 - build the docker image for your service

Build the image

    docker build -t netflix-conductor:1.0 .

### Step 5 - run your service

    docker run --name netflix -d -t -e ACS_GATEWAY_HOST=<PLATFORM_HOST> -e BASE_URI=<SERVICE_HOST> netflix-conductor:1.0

## Extensibility

Service is generated based on the *serviceDefinition* object created as part of RAML interpretation.

The code is generated using [ejs](https://www.npmjs.com/package/ejs) templates. You can modify or create new teamplates according to your needs.

After service is generated you can use it as a foundation and add/change/modify the service logic.

## FAQ

#### Why am I seeing 'Authentication error: Client IP is not allowed either by gateway or service policy'?

You'll need to make sure the IP mask is open on the gateway

#### Why am I getting '404 Not Found: proxy-bal'?

You'll need to include proxy-bal module

#### How to include proxy-bal  
Proxy-bal is package accesible only for developers with a Avid developer account  
Steps include proxy-bal:  
1. Download proxy-bal package from https://my.avid.com/cpp/sdk/apc (Avid Platform Connector Node)
2. Extract downloaded files
3. Enter the extracted directory and then node_modules directory
3. Extract proxy-bal.tgz file
4. Rename package directory to proxy-bal
5. Copy the proxy-bal directory to node_modules in service directory
6. Open command line inside proxy-bal directory and type npm update

---
_Source: https://npm.io/package/mediacentral-service-rest-bridge-toolkit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
