feat: one install and one import per database; server dialects open their pool from a URL; nodeListener answers a throwing context; 0.5.0

This commit is contained in:
2026-11-03 13:06:04 +01:00
parent 1391c21c1f
commit e7637c3704
24 changed files with 194 additions and 227 deletions
+5 -5
View File
@@ -32,19 +32,19 @@ Your backend stays in charge:
| `@crudy/restloom-express` | Express handler |
```sh
npm install @crudy/restloom @crudy/restloom-postgres pg
npm install @crudy/restloom-postgres
```
A database package brings the core and its driver, and exports the whole core.
## Use
```ts
import http from 'node:http';
import pg from 'pg';
import { createREST, nodeListener } from '@crudy/restloom';
import { postgres } from '@crudy/restloom-postgres';
import { createREST, nodeListener, postgres } from '@crudy/restloom-postgres';
const rest = createREST({
db: postgres(new pg.Pool()),
db: postgres(process.env.DATABASE_URL),
expose: { schemas: ['app'] },
resources: { todos: { write: true } },
});