Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axway-api-builder-ext/api-builder-plugin-dc-postgres

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axway-api-builder-ext/api-builder-plugin-dc-postgres

PostgreSQL data connector for Axway API Builder

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
3
Weekly downloads
 
Created
Source

PostgreSQL Connector

The PostgreSQL data connector is a plugin for API Builder that can connect to your PostgreSQL database instance and interrogate your schema that will automatically provision Models into to your project, and optionally, automatically generate a rich CRUD API to the underlying tables. The Models can be used programmatically, or can be used within the flow editor to interact with your database.

Minimum requirements

Supported versions

  • PostgreSQL 9.6
  • Other versions might be supported as well, please create an issue if encounter any.

Memory

  • ~7 MB

Disk space

  • ~10 MB

Supported features

  • Automatic generation of Models from SQL tables
  • Automatic generation of API for Models
  • Full CRUD operations on tables via Models
  • Connection pooling

Installation

npm install --no-optional @axway-api-builder-ext/api-builder-plugin-dc-postgres

A configuration file is generated for you and placed into the conf directory of your API Builder project. The configuration for your PostgreSQL is expected to be in environment variables or in the conf/.env file during development.

Configuration

Once the plugin is installed, the configuration file is located <project>/conf/postgres.default.js.

Option nameTypeDescription
connectorstringMust be: @axway-api-builder-ext/api-builder-plugin-dc-postgres
connectionPoolingbooleanboolean Enables connection pooling for better performance and scalability.
connectionLimitnumberNumber of simultaneous connections when connectionPooling is enabled.
hoststringThe database host.
portnumberThe database post.
databasestringThe database instance name.
schemestringThe schema within your database to use
userstringThe user with which to connect to the database.
passwordstringThe user's password with which to connect to the database.
generateModelsFromSchemabooleanIf enabled, API Builder will automatically interrogate the database and auto-generate Models from SQL tables.
modelAutogenbooleanIf enabled, API Builder will automatically generate a full and rich CRUD API from the generated Models.

Usage

After you configure the connector, you can start up your API Builder project and visit the console (normally found under http://localhost:8080/console). Your connector will be listed under the Connectors section of the console.

Your database tables will be listed under the Models section of the console. You can now click on the gear icon to the right of the table names and generate flow based APIs.

You can also reference the connector in a custom model.

const Account = APIBuilder.Model.extend('Account', {
  fields: {
    Name: { type: String, required: true }
  },
  connector: 'postgres'
});

If you want to map a specific model to a specific table, use metadata. For example, to map the account model to the table named accounts, set it such as:

const Account = APIBuilder.Model.extend('account', {
  fields: {
    Name: { type: String, required: false, validator: /[a-zA-Z]{3,}/ }
  },
  connector: 'postgres',
  metadata: {
    'mysql': {
      table: 'accounts'
    }
  }
});

Known issues and limitations

  1. Only supports SQL tables.
  2. Does not support views.
  3. Does not support stored procedures.

Contributing

Please read Contributing.md for details on our code of conduct, and the process for submitting pull requests to us.

Team

alt text Axway Team

Keywords

FAQs

Package last updated on 26 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc