rewait: cleaner alternative to wait-on.
Any networked software project hits a similar obstacle: the app boots faster than the
database, crashes, and someone adds sleep 5 or npx wait-on, etc.
rewait gives you fine-tuned control over this obstacle, either via simple & familiar TypeScript, or CLI.
import { rewait, http, tcp } from "rewait";
await rewait([
http("http://localhost:8080/"),
tcp("localhost", 5432),
], {
timeout: 30_000,
interval: 250,
});
I wrote this package many years ago for Hello Privacy in pure JS, and it really solved a need for us back then. The existing tooling didn’t offer enough control or a clean enough API. So I wrote a nice clean functional programming API.
In 2022 I rewrote it in TypeScript for my own use, but never released it.
Now the 2.x is fully released on npm with 100% test coverage and no funny business with the static type analysis.