Skip to content

Parses PostgreSQL database URL string and returns values for `user`, `password`, `host`, `port` and database `name`.

Notifications You must be signed in to change notification settings

nullthefirst/postgres-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

postgres-parser

Parses PostgreSQL database URL string and returns values for user, password, host, port and database name.

Installation

npm install @usheninte/postgres-parser
// OR
yarn add @usheninte/postgres-parser

Do the following to use the package

const dbstring = require('@usheninte/postgres-parser');

const { user, password, host, port, name } = dbstring(
  'postgres://USER:PASSWORD@HOST:PORT/NAME',
);

Output from the following test string postgres://USER:PASSWORD@HOST:PORT/NAME

{
  "user": "USER",
  "password": "PASSWORD",
  "host": "HOST",
  "port": "PORT",
  "name": "NAME"
}

About

Parses PostgreSQL database URL string and returns values for `user`, `password`, `host`, `port` and database `name`.

Resources

Stars

Watchers

Forks