You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Sven Slootweg 67e28e9071 Initial commit 5 vuotta sitten
.gitignore Initial commit 5 vuotta sitten
README.md Initial commit 5 vuotta sitten
example.js Initial commit 5 vuotta sitten
index.js Initial commit 5 vuotta sitten
package.json Initial commit 5 vuotta sitten
yarn.lock Initial commit 5 vuotta sitten

README.md

postgresql-socket-url

Generates a well-formed URL for a given PostgreSQL domain socket path and database name. Useful when you want to use a database driver (like pg) to connect to PostgreSQL through a Unix domain socket.

Example

"use strict";

const postgresqlSocketUrl = require("postgresql-socket-url");

let url = postgresqlSocketUrl({
	socketPath: "/tmp",
	database: "myproject"
});

console.log(url); // socket:/tmp?db=myproject

API

postgresqlSocketUrl(options)

Generates the URL to connect to.

  • options:
    • socketPath: The path of the folder that contains the PostgreSQL socket. Not the path of the socket itself.
    • database: The name of the database to connect to.

Changelog

1.0.0 (September 14, 2019)

Initial release.