1.0.34 • Published 1 year ago

@adedayomatthews/proxy-manager v1.0.34

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

This package is usable with express application to configure and manage endpoints for a configurable gateway. It also autogenerate a Swagger documentation.

Install

npm i @adedayomatthews/proxy-manager

Usage

The package uses Sequelize ORM. Create a sequelize.js in your root folder of your project and configure the database connection there as:

module.export = {
    "username": "root",
    "password": "root",
    "database": "database_name",
    "host": "127.0.0.1",
    "dialect": "mysql"
 }

Setup an express application

const express = require('express');
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: false }));

Initialize the proxy manager with the express app

const { ProxyManager} = require("@adedayomatthews/proxy-manager");
const proxyManager = new ProxyManager(app)

Add the router for managing endpoints

app.use('/', proxyManager.getManagementRouter())

Include Swagger documentation

proxyManager.addDocumentation()

Include script in package.json

    "proxy-sync": "cd ./node_modules/@adedayomatthews/proxy-manager && npm run sequelize-sync"

You can now run npm run proxy-sync to sync the sequelize models. You can also hook into Pre & Post Scripts to ensure the proxy is always synced. If you have a start script, you can add a prestart script, for example:

    "start": "node app.js",
    "prestart": "npm run proxy-sync",
    "proxy-sync": "cd ./node_modules/@adedayomatthews/proxy-manager && npm run sequelize-sync"
1.0.33

1 year ago

1.0.32

1 year ago

1.0.34

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.24

1 year ago

1.0.22

1 year ago

1.0.23

1 year ago

1.0.19

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.18

1 year ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.5

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago