1.0.30 • Published 26 days ago

@adedayomatthews/proxy-manager v1.0.30

Weekly downloads
-
License
MIT
Repository
github
Last release
26 days 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.30

26 days ago

1.0.29

26 days ago

1.0.28

26 days ago

1.0.27

3 months ago

1.0.26

3 months ago

1.0.24

3 months ago

1.0.22

3 months ago

1.0.23

3 months ago

1.0.19

3 months ago

1.0.21

3 months ago

1.0.20

3 months ago

1.0.18

3 months ago

1.0.17

5 months ago

1.0.16

5 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.5

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago