jdziat/parse-connection-url


A library to help parse out connection strings.

License: MIT

Language: JavaScript


Parse Connection Url

Standard - JavaScript Style Guide

A Nodejs module that allows you to parse connection strings/objects in a consistent way.

Table of Contents

Documentation

Click on the following link to go to the full documentation. Documentation

Installation

npm i -S parse-connection-url

Usage

const Connection = require('parse-connection-url')
const httpConn = new Connection('http://admin:admin@localhost:8443/some/path')
console.log(httpConn)
// {
//   connection: 
//    { secure: false,
//      protocol: 'http',
//      port: 8443,
//      path: '/some/pathn',
//      hostname: 'localhost' },
//   auth: { username: 'admin', password: 'admin' } }
console.log(httpConn.toUrl())
// "http://admin:admin@localhost:8443/some/path"

const knexPostgresConn = new Connection('postgres://admin:admin@localhost:5432/generic_database')
console.log(knexPostgresConn)
//  {
//   connection: 
//    { secure: false,
//      protocol: 'postgres',
//      port: 5432,
//      path: '/generic_database',
//      hostname: 'localhost' },
//   auth: { username: 'admin', password: 'admin' } }
console.log(knexPostgresConn.toKnexConnection())
// { host: 'localhost',
//   user: 'admin',
//   password: 'admin',
//   port: 5432,
//   database: 'generic_database' }

Support

Please open an issue for support.

Contributing

Project Statistics

Sourcerank 3
Repository Size 658 KB
Stars 0
Forks 0
Watchers 1
Open issues 0
Dependencies 224
Contributors 1
Tags 31
Created
Last updated
Last pushed

Top Contributors See all

Jordan Dziat

Packages Referencing this Repo

parse-connection-url
A Nodejs module that allows you to parse connection strings/objects in a consistent way.
Latest release 1.3.4 - Updated

Recent Tags See all

v1.3.4 July 11, 2019
v1.3.3 August 22, 2018
v1.3.2 June 18, 2018
v1.3.2 June 18, 2018
v1.3.1 June 18, 2018
v1.3.1 June 18, 2018
v1.3.0 June 18, 2018
v1.3.0 June 18, 2018
v1.2.4 June 18, 2018
v1.2.3 June 10, 2018
v1.2.2 June 08, 2018
v1.2.1 June 08, 2018
v1.2.0 June 08, 2018
v1.2.0 June 08, 2018
v1.1.0 June 06, 2018

Something wrong with this page? Make a suggestion

Last synced: 2019-07-11 14:49:46 UTC

Login to resync this repository