parse-connection-string
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

parse-connection-string

parse-connection-string takes a standard MS SQL server connection string, parses it and converts into a format suitable for Knex.

API

import parse from "parse-connection-string";
import knex from "knex";
 
const connStr = process.env.MSSQL_CONNECTION_STRING;
const config = parse(connStr).toKnexConfig();
 
const db = knex({
  client: "mssql",
  connection: config
});

Simply pass your connection string into the parseConnectionString function and call one of the output functions on the result to get the options in the format you want. At the moment there's only toKnexConfig(). Other formats will be added as necessary.

Running Tests

Run yarn test in this directory to run unit tests.

Readme

Keywords

none

Package Sidebar

Install

npm i parse-connection-string

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

7.76 kB

Total Files

17

Last publish

Collaborators

  • schwingbat