-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.ts
More file actions
36 lines (29 loc) · 1020 Bytes
/
server.ts
File metadata and controls
36 lines (29 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* MSW Server Example - Runtime Integration
*
* This example shows how to use the MSW plugin with ObjectStack Runtime.
* This is useful for Node.js testing environments or development.
*/
import { ObjectStackKernel } from '@objectstack/runtime';
import { InMemoryDriver } from '@objectstack/driver-memory';
import { MSWPlugin } from '@objectstack/plugin-msw';
import CrmApp from '@objectstack/example-crm/objectstack.config';
(async () => {
console.log('🚀 Starting ObjectStack with MSW Plugin...');
const kernel = new ObjectStackKernel([
CrmApp,
new InMemoryDriver(),
// Add MSW Plugin for API mocking
new MSWPlugin({
enableBrowser: false, // Disable browser mode for Node.js
baseUrl: '/api/v1',
logRequests: true,
customHandlers: [
// You can add custom handlers here
]
})
]);
await kernel.start();
console.log('✅ MSW Plugin initialized');
console.log('📝 All API endpoints are now mocked and ready for testing');
})();