A package to run an mini postgres database right from NodeJS.
npm i postgres-mini
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()
Postgres mini was created based on the inspiration of Lei Nelissen embedded-postgres package.