A CLI tool that allows you to ensure a database is live before closing the process.
AWAITABASE_EXAMPLE.mov
# If the optionalUrl is not defined, it will default to the DATABASE_URL environment variable.
npx awaitabase [driver] [optionalUrl]
npx awaitabase postgres postgres://user:password@localhost/database
# โ ผ Connecting to database... 0/30
# โ ผ Connecting to database... 1/30
# โ Database confirmed as active
npm i -D awaitabase
// package.json
{
// ...
"scripts": {
"database:wait": "awaitabase postgres postgres://user:password@localhost/database",
"start": "database:wait && node ."
}
// ...
}