postgres-mini
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

postgres-mini

A package to run an mini postgres database right from NodeJS.

Install

npm i postgres-mini

Usage

import Postgres from 'postgres-mini'

async function main() {
    // Create a postgres instance.
    const pgInstance = await Postgres.create()

    // Initialize the postgres instance and set all configuration  
    await pgInstance.initialize()

    // Start the postgres instances
    await pgInstance.start()

    // Create a database
    await pgInstance.createDatabase("PERSON")

    // Make a query
    const result = await pgInstance.query("SELECT datname FROM pg_database")

    // Stop the postgres instances
    await pgInstance.stop()
}

main()

Documentation

Link

Credits

Postgres mini was created based on the inspiration of Lei Nelissen embedded-postgres package.

Package Sidebar

Install

npm i postgres-mini

Weekly Downloads

0

Version

0.1.3

License

MIT

Unpacked Size

44.5 kB

Total Files

15

Last publish

Collaborators

  • danielonyenwee