1.3.4 • Published 5 years ago

parse-connection-url v1.3.4

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Parse Connection Url

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

1.3.4

5 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago