@korajs/server 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/index.cjs +250 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +142 -2
- package/dist/index.d.ts +142 -2
- package/dist/index.js +246 -76
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -52,6 +52,39 @@ await server.start()
|
|
|
52
52
|
| `SqliteServerStore` | Built-in | Small deployments, prototyping |
|
|
53
53
|
| `PostgresServerStore` | Built-in | Production |
|
|
54
54
|
|
|
55
|
+
## Mixed Auth (Authenticated + Anonymous)
|
|
56
|
+
|
|
57
|
+
For apps where some users are authenticated and others are anonymous:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { MixedAuthProvider } from '@korajs/server'
|
|
61
|
+
|
|
62
|
+
const server = createKoraServer({
|
|
63
|
+
store: serverStore,
|
|
64
|
+
auth: new MixedAuthProvider({
|
|
65
|
+
primary: authRoutes.toSyncAuthProvider(),
|
|
66
|
+
anonymousScopes: { responses: {} },
|
|
67
|
+
}),
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Materialized Collections
|
|
72
|
+
|
|
73
|
+
Enable server-side queries on your data:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
await store.setSchema(schema)
|
|
77
|
+
|
|
78
|
+
// Query with filters
|
|
79
|
+
const forms = await store.queryCollection('forms', {
|
|
80
|
+
where: { status: 'published' },
|
|
81
|
+
limit: 10,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Count records
|
|
85
|
+
const count = await store.countCollection('responses', { formId: 'abc' })
|
|
86
|
+
```
|
|
87
|
+
|
|
55
88
|
## Configuration
|
|
56
89
|
|
|
57
90
|
```typescript
|