https://github.com/daniel-onyenwee/postgres-mini
A package to run an mini postgresql database right from NodeJS
https://github.com/daniel-onyenwee/postgres-mini
database mini postgres postgresql sql
Last synced: about 2 months ago
JSON representation
A package to run an mini postgresql database right from NodeJS
- Host: GitHub
- URL: https://github.com/daniel-onyenwee/postgres-mini
- Owner: daniel-onyenwee
- Created: 2024-03-18T01:56:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-22T00:14:15.000Z (over 2 years ago)
- Last Synced: 2024-10-16T01:31:57.156Z (over 1 year ago)
- Topics: database, mini, postgres, postgresql, sql
- Language: TypeScript
- Homepage: https://daniel-onyenwee.github.io/postgres-mini/
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# postgres-mini
A package to run an mini postgres database right from NodeJS.
## Install
```bash
npm i postgres-mini
```
## Usage
```ts
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](https://daniel-onyenwee.github.io/postgres-mini/)
## Credits
Postgres mini was created based on the inspiration of Lei Nelissen [embedded-postgres](https://github.com/leinelissen/embedded-postgres) package.