bun-platform-kit 1.0.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.
Files changed (54) hide show
  1. package/README.md +82 -0
  2. package/dist/BunKitServer.d.ts +31 -0
  3. package/dist/BunKitServer.js +173 -0
  4. package/dist/BunKitStandardServer.d.ts +18 -0
  5. package/dist/BunKitStandardServer.js +53 -0
  6. package/dist/abstract/ServerModule.d.ts +7 -0
  7. package/dist/abstract/ServerModule.js +12 -0
  8. package/dist/abstract/ServerService.d.ts +6 -0
  9. package/dist/abstract/ServerService.js +9 -0
  10. package/dist/abstract/ServerTypes.d.ts +78 -0
  11. package/dist/abstract/ServerTypes.js +7 -0
  12. package/dist/abstract/index.d.ts +3 -0
  13. package/dist/abstract/index.js +19 -0
  14. package/dist/adapters/BunAdapter.d.ts +12 -0
  15. package/dist/adapters/BunAdapter.js +1165 -0
  16. package/dist/adapters/index.d.ts +1 -0
  17. package/dist/adapters/index.js +17 -0
  18. package/dist/controllers/ReportFinanceController.d.ts +0 -0
  19. package/dist/controllers/ReportFinanceController.js +1 -0
  20. package/dist/decorators/Controller.d.ts +2 -0
  21. package/dist/decorators/Controller.js +13 -0
  22. package/dist/decorators/DecoratorGuards.d.ts +1 -0
  23. package/dist/decorators/DecoratorGuards.js +14 -0
  24. package/dist/decorators/Handlers.d.ts +18 -0
  25. package/dist/decorators/Handlers.js +35 -0
  26. package/dist/decorators/MetadataKeys.d.ts +6 -0
  27. package/dist/decorators/MetadataKeys.js +10 -0
  28. package/dist/decorators/Parameters.d.ts +24 -0
  29. package/dist/decorators/Parameters.js +41 -0
  30. package/dist/decorators/Use.d.ts +3 -0
  31. package/dist/decorators/Use.js +26 -0
  32. package/dist/decorators/index.d.ts +5 -0
  33. package/dist/decorators/index.js +21 -0
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.js +27 -0
  36. package/dist/modules/ControllersModule.d.ts +11 -0
  37. package/dist/modules/ControllersModule.js +138 -0
  38. package/dist/modules/CorsModule.d.ts +12 -0
  39. package/dist/modules/CorsModule.js +89 -0
  40. package/dist/modules/FileUploadModule.d.ts +21 -0
  41. package/dist/modules/FileUploadModule.js +20 -0
  42. package/dist/modules/RateLimitModule.d.ts +18 -0
  43. package/dist/modules/RateLimitModule.js +61 -0
  44. package/dist/modules/RequestContextModule.d.ts +18 -0
  45. package/dist/modules/RequestContextModule.js +52 -0
  46. package/dist/modules/SecurityModule.d.ts +11 -0
  47. package/dist/modules/SecurityModule.js +65 -0
  48. package/dist/modules/index.d.ts +6 -0
  49. package/dist/modules/index.js +22 -0
  50. package/dist/testing/createDecoratedTestApp.d.ts +19 -0
  51. package/dist/testing/createDecoratedTestApp.js +49 -0
  52. package/dist/testing/index.d.ts +1 -0
  53. package/dist/testing/index.js +17 -0
  54. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # Bun Platform Kit
2
+
3
+ A TypeScript framework for Bun, dev-friendly and enterprise-ready. Organize APIs with modules, services, and decorated controllers, ship essential middleware out of the box, and keep end-to-end typing without friction.
4
+
5
+ ## Features
6
+
7
+ - ๐Ÿงฉ **Modular architecture**: add, replace, or disable modules without coupling to the core
8
+ - ๐Ÿš€ **Background services**: start processes and workers with `BaseServerService`
9
+ - ๐Ÿงฐ **Standard preset**: CORS, security headers, in-memory rate limit, uploads, and request context
10
+ - ๐Ÿงญ **Clear priorities**: deterministic module initialization order
11
+ - ๐Ÿ”’ **Safe defaults**: reasonable headers and limits out of the box
12
+ - ๐Ÿงช **Simple testing**: helper for decorated apps without repeated bootstrap
13
+ - ๐Ÿ›ก๏ธ **Real type safety**: strong typing on request, response, and decorators
14
+ - ๐ŸŽฏ **Clean decorators**: declarative, easy-to-maintain routes
15
+
16
+ ## Benefits
17
+
18
+ - โšก **Fast time-to-first-endpoint** with the standard preset
19
+ - ๐Ÿค **Team consistency** with clear module/service patterns
20
+ - ๐Ÿงฑ **Scalable**: add pieces without rewriting the server
21
+ - ๐Ÿ” **Basic observability** with requestId and per-request context
22
+ - โœ… **Reliable testing** with bootstrap helpers for tests
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ bun add bun-platform-kit
28
+ ```
29
+
30
+ ## Documentation
31
+
32
+ - [Getting Started](docs/getting-started.md)
33
+ - [Core Concepts](docs/core-concepts.md)
34
+ - [Modules](docs/modules.md)
35
+ - [Using Decorators](docs/decorators.md)
36
+ - [Services](docs/services.md)
37
+ - [Testing Helpers](docs/testing.md)
38
+ - [API Reference](docs/api-reference.md)
39
+ - [Examples](docs/examples.md)
40
+
41
+ ## File uploads
42
+
43
+ With `BunKitStandardServer`, uploads are enabled by default. If you use `BunKitServer` directly or disable the module, you need to register `FileUploadModule`. Configure limits and allowlists through the module:
44
+
45
+ ```typescript
46
+ import { FileUploadModule } from "bun-platform-kit";
47
+
48
+ const fileUpload = new FileUploadModule({
49
+ maxBodyBytes: 10 * 1024 * 1024,
50
+ maxFileBytes: 10 * 1024 * 1024,
51
+ maxFiles: 10,
52
+ allowedMimeTypes: ["image/*", "application/pdf"],
53
+ });
54
+ ```
55
+
56
+ ## Contributing
57
+
58
+ 1. Fork the repository
59
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
60
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
61
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
62
+ 5. Open a Pull Request
63
+
64
+ ## Conventional Commits
65
+
66
+ We use Conventional Commits to automatically generate releases:
67
+
68
+ - `feat:` - New feature
69
+ - `fix:` - Bug fix
70
+ - `docs:` - Documentation
71
+ - `style:` - Format, spaces, etc.
72
+ - `refactor:` - Code refactoring
73
+ - `test:` - Add tests
74
+ - `chore:` - Maintenance tasks
75
+
76
+ ## License
77
+
78
+ This project is licensed under the MIT License - see the LICENSE file for details.
79
+
80
+ ## Author
81
+
82
+ Angel Bejarano - angel.bejarano@jaspesoft.com
@@ -0,0 +1,31 @@
1
+ import { BaseServerModule, BaseServerService } from "./abstract";
2
+ import { ServerAdapter, ServerApp, ServerInstance } from "./abstract";
3
+ export interface BunKitServerOptions {
4
+ adapter?: ServerAdapter;
5
+ }
6
+ export declare class BunKitServer {
7
+ private readonly app;
8
+ private readonly port;
9
+ private server?;
10
+ private modules;
11
+ private services;
12
+ private readonly adapter;
13
+ private readonly runtime;
14
+ constructor(port: number, options?: BunKitServerOptions);
15
+ removeModule(moduleName: string): BunKitServer;
16
+ addModule(module: BaseServerModule): BunKitServer;
17
+ addModules(modules: BaseServerModule[]): BunKitServer;
18
+ addService(service: BaseServerService): BunKitServer;
19
+ addServices(services: BaseServerService[]): BunKitServer;
20
+ getApp(): ServerApp;
21
+ getServer(): ServerInstance | undefined;
22
+ getHttpServer(): ServerInstance | undefined;
23
+ initialize(): Promise<void>;
24
+ start(): Promise<void>;
25
+ gracefulShutdown(): Promise<void>;
26
+ getModule<T extends BaseServerModule>(moduleClass: new (...args: any[]) => T): T | undefined;
27
+ hasModule(moduleClass: new (...args: any[]) => any): boolean;
28
+ private initializeServices;
29
+ private initializeServerModules;
30
+ private setupGracefulShutdown;
31
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BunKitServer = void 0;
4
+ const adapters_1 = require("./adapters");
5
+ class BunKitServer {
6
+ constructor(port, options) {
7
+ this.modules = [];
8
+ this.services = [];
9
+ this.port = port;
10
+ this.adapter = options?.adapter ?? new adapters_1.BunAdapter();
11
+ this.runtime = this.adapter.runtime;
12
+ this.app = this.adapter.createApp();
13
+ this.adapter.configure(this.app, port);
14
+ }
15
+ removeModule(moduleName) {
16
+ this.modules = this.modules.filter((m) => m.getModuleName() !== moduleName);
17
+ return this;
18
+ }
19
+ addModule(module) {
20
+ const existingModuleIndex = this.modules.findIndex((m) => m.getModuleName() === module.getModuleName());
21
+ if (existingModuleIndex !== -1) {
22
+ // Replace existing module
23
+ this.modules[existingModuleIndex] = module;
24
+ }
25
+ else {
26
+ // Add new module
27
+ this.modules.push(module);
28
+ }
29
+ return this;
30
+ }
31
+ addModules(modules) {
32
+ for (const module of modules) {
33
+ const existingModuleIndex = this.modules.findIndex((m) => m.getModuleName() === module.getModuleName());
34
+ if (existingModuleIndex !== -1) {
35
+ // Replace existing module
36
+ this.modules[existingModuleIndex] = module;
37
+ }
38
+ else {
39
+ // Add new module
40
+ this.modules.push(module);
41
+ }
42
+ }
43
+ return this;
44
+ }
45
+ addService(service) {
46
+ this.services.push(service);
47
+ return this;
48
+ }
49
+ addServices(services) {
50
+ this.services.push(...services);
51
+ return this;
52
+ }
53
+ getApp() {
54
+ return this.app;
55
+ }
56
+ getServer() {
57
+ return this.server;
58
+ }
59
+ getHttpServer() {
60
+ return this.server;
61
+ }
62
+ async initialize() {
63
+ await this.initializeServerModules();
64
+ }
65
+ async start() {
66
+ await this.initializeServerModules();
67
+ return new Promise((resolve) => {
68
+ this.server = this.adapter.listen(this.app, this.port, () => {
69
+ console.log(`Server running on port ${this.port}`);
70
+ this.setupGracefulShutdown();
71
+ resolve();
72
+ });
73
+ this.initializeServices(this.server);
74
+ });
75
+ }
76
+ async gracefulShutdown() {
77
+ try {
78
+ console.log("Starting graceful shutdown...");
79
+ // Execute module shutdown in reverse order
80
+ const reversedModules = [...this.modules].reverse();
81
+ for (const module of reversedModules) {
82
+ if (module.shutdown) {
83
+ try {
84
+ console.log(`Shutting down module: ${module.getModuleName()}`);
85
+ await module.shutdown();
86
+ console.log(`Module shutdown completed: ${module.getModuleName()}`);
87
+ }
88
+ catch (error) {
89
+ console.error(`Error shutting down module ${module.getModuleName()}:`, error);
90
+ }
91
+ }
92
+ }
93
+ // Stop services in reverse order
94
+ const reversedServices = [...this.services].reverse();
95
+ for (const service of reversedServices) {
96
+ if (service.stop) {
97
+ try {
98
+ console.log(`Stopping service: ${service.name}`);
99
+ await service.stop();
100
+ console.log(`Service stopped: ${service.name}`);
101
+ }
102
+ catch (error) {
103
+ console.error(`Error stopping service ${service.name}:`, error);
104
+ }
105
+ }
106
+ }
107
+ // Close HTTP server
108
+ if (this.server) {
109
+ console.log("Closing server...");
110
+ await new Promise((resolve) => {
111
+ this.server.close(() => resolve());
112
+ });
113
+ console.log("Server closed");
114
+ }
115
+ console.log("Graceful shutdown completed. Exiting...");
116
+ process.exit(0);
117
+ }
118
+ catch (error) {
119
+ console.error("Error during graceful shutdown:", error);
120
+ process.exit(1);
121
+ }
122
+ }
123
+ // Convenience methods to access specific modules
124
+ getModule(moduleClass) {
125
+ return this.modules.find((m) => m instanceof moduleClass);
126
+ }
127
+ hasModule(moduleClass) {
128
+ return this.modules.some((m) => m instanceof moduleClass);
129
+ }
130
+ async initializeServices(server) {
131
+ console.log("Starting services...");
132
+ for (const service of this.services) {
133
+ try {
134
+ await service.start(server);
135
+ console.log(`Service started: ${service.name}`);
136
+ }
137
+ catch (error) {
138
+ console.error(`Failed to start service ${service.name}:`, error);
139
+ throw error;
140
+ }
141
+ }
142
+ console.log("All services started successfully");
143
+ }
144
+ async initializeServerModules() {
145
+ // Sort modules by priority (lower number = higher priority)
146
+ this.modules.sort((a, b) => (a.priority || 0) - (b.priority || 0));
147
+ console.log("Initializing server modules in priority order:");
148
+ const context = {
149
+ runtime: this.runtime,
150
+ adapter: this.adapter,
151
+ };
152
+ for (const module of this.modules) {
153
+ try {
154
+ await module.init(this.app, context);
155
+ console.log(`Module initialized: ${module.getModuleName()}`);
156
+ }
157
+ catch (error) {
158
+ console.error(`Failed to initialize module ${module.getModuleName()}:`, error);
159
+ throw error;
160
+ }
161
+ }
162
+ console.log("All modules initialized successfully");
163
+ }
164
+ setupGracefulShutdown() {
165
+ const shutdown = async (signal) => {
166
+ console.log(`${signal} signal received. Shutting down application...`);
167
+ await this.gracefulShutdown();
168
+ };
169
+ process.on("SIGINT", () => shutdown("SIGINT"));
170
+ process.on("SIGTERM", () => shutdown("SIGTERM"));
171
+ }
172
+ }
173
+ exports.BunKitServer = BunKitServer;
@@ -0,0 +1,18 @@
1
+ import { BunKitServer } from "./BunKitServer";
2
+ import { ControllersModule } from "./modules";
3
+ import { BaseServerModule, BaseServerService, ServerAdapter } from "./abstract";
4
+ export interface BunKitStandardServerOptions {
5
+ adapter?: ServerAdapter;
6
+ modules?: {
7
+ cors?: BaseServerModule | false;
8
+ security?: BaseServerModule | false;
9
+ rateLimit?: BaseServerModule | false;
10
+ fileUpload?: BaseServerModule | false;
11
+ requestContext?: BaseServerModule | false;
12
+ extra?: BaseServerModule[];
13
+ };
14
+ services?: BaseServerService[];
15
+ }
16
+ export declare function BunKitStandardServer(port: number, module: ControllersModule, services?: BaseServerService[]): BunKitServer;
17
+ export declare function BunKitStandardServer(port: number, module: ControllersModule, services: BaseServerService[], options: BunKitStandardServerOptions): BunKitServer;
18
+ export declare function BunKitStandardServer(port: number, module: ControllersModule, options: BunKitStandardServerOptions): BunKitServer;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BunKitStandardServer = BunKitStandardServer;
4
+ const BunKitServer_1 = require("./BunKitServer");
5
+ const modules_1 = require("./modules");
6
+ function BunKitStandardServer(port, arg2, arg3, arg4) {
7
+ let controllersModule;
8
+ let services;
9
+ let options;
10
+ controllersModule = arg2;
11
+ const addServices = (value) => {
12
+ if (!value?.length) {
13
+ return;
14
+ }
15
+ services = [...(services ?? []), ...value];
16
+ };
17
+ const processOptionalArg = (value) => {
18
+ if (!value) {
19
+ return;
20
+ }
21
+ if (Array.isArray(value)) {
22
+ addServices(value);
23
+ return;
24
+ }
25
+ options = value;
26
+ };
27
+ processOptionalArg(arg3);
28
+ processOptionalArg(arg4);
29
+ addServices(options?.services);
30
+ const modulesToRegister = [controllersModule];
31
+ const preset = options?.modules;
32
+ const registerModule = (factory, override) => {
33
+ if (override === false) {
34
+ return;
35
+ }
36
+ modulesToRegister.push(override ?? factory());
37
+ };
38
+ registerModule(() => new modules_1.CorsModule(), preset?.cors);
39
+ registerModule(() => new modules_1.SecurityModule(), preset?.security);
40
+ registerModule(() => new modules_1.RateLimitModule(), preset?.rateLimit);
41
+ registerModule(() => new modules_1.FileUploadModule(), preset?.fileUpload);
42
+ registerModule(() => new modules_1.RequestContextModule(), preset?.requestContext);
43
+ if (preset?.extra?.length) {
44
+ modulesToRegister.push(...preset.extra);
45
+ }
46
+ const server = new BunKitServer_1.BunKitServer(port, {
47
+ adapter: options?.adapter,
48
+ }).addModules(modulesToRegister);
49
+ if (services) {
50
+ server.addServices(services);
51
+ }
52
+ return server;
53
+ }
@@ -0,0 +1,7 @@
1
+ import { ServerApp, ServerContext } from "./ServerTypes";
2
+ export declare abstract class BaseServerModule {
3
+ priority: number;
4
+ abstract getModuleName(): string;
5
+ abstract init(app: ServerApp, context?: ServerContext): Promise<void> | void;
6
+ shutdown(): Promise<void>;
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseServerModule = void 0;
4
+ class BaseServerModule {
5
+ constructor() {
6
+ this.priority = 0;
7
+ }
8
+ async shutdown() {
9
+ // Default empty shutdown
10
+ }
11
+ }
12
+ exports.BaseServerModule = BaseServerModule;
@@ -0,0 +1,6 @@
1
+ import { ServerInstance } from "./ServerTypes";
2
+ export declare abstract class BaseServerService {
3
+ abstract name: string;
4
+ abstract start(server: ServerInstance): Promise<void> | void;
5
+ stop(): Promise<void>;
6
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseServerService = void 0;
4
+ class BaseServerService {
5
+ async stop() {
6
+ // Default empty stop
7
+ }
8
+ }
9
+ exports.BaseServerService = BaseServerService;
@@ -0,0 +1,78 @@
1
+ export declare enum ServerRuntime {
2
+ Bun = "bun"
3
+ }
4
+ export type NextFunction = (err?: unknown) => void;
5
+ export type ServerHandler = (req: any, res: any, next: NextFunction) => any;
6
+ export interface ServerRequest {
7
+ method: string;
8
+ path: string;
9
+ originalUrl?: string;
10
+ params: Record<string, string>;
11
+ query: Record<string, string | string[]>;
12
+ headers: Record<string, string | string[] | undefined>;
13
+ body?: unknown;
14
+ files?: ServerFiles;
15
+ cookies?: Record<string, string>;
16
+ ip?: string;
17
+ requestId?: string;
18
+ raw?: unknown;
19
+ }
20
+ export interface ServerResponse {
21
+ status(code: number): this;
22
+ json(body: unknown): void | Promise<void>;
23
+ send(body: unknown): void | Promise<void>;
24
+ set(name: string, value: string): this;
25
+ header(name: string, value: string): this;
26
+ setHeader?(name: string, value: string): this;
27
+ cookie?(name: string, value: string, options?: {
28
+ maxAge?: number;
29
+ domain?: string;
30
+ path?: string;
31
+ expires?: Date;
32
+ httpOnly?: boolean;
33
+ secure?: boolean;
34
+ sameSite?: "lax" | "strict" | "none";
35
+ }): this;
36
+ download?(path: string, filename?: string, callback?: (err?: unknown) => void): this;
37
+ end(body?: unknown): void | Promise<void>;
38
+ }
39
+ export type BunMultipartFile = {
40
+ name: string;
41
+ size: number;
42
+ type: string;
43
+ slice?: (start?: number, end?: number) => {
44
+ arrayBuffer(): Promise<ArrayBuffer>;
45
+ };
46
+ arrayBuffer(): Promise<ArrayBuffer>;
47
+ text?: () => Promise<string>;
48
+ lastModified?: number;
49
+ };
50
+ export type ServerFile = BunMultipartFile;
51
+ export type ServerFiles = Record<string, ServerFile | ServerFile[]>;
52
+ export type ServerHandlerInput = ServerHandler | ServerHandler[] | ServerRouter;
53
+ export interface ServerRouter {
54
+ use(pathOrHandler: string | ServerHandlerInput, ...handlers: ServerHandlerInput[]): void;
55
+ get(path: string, ...handlers: ServerHandler[]): void;
56
+ post(path: string, ...handlers: ServerHandler[]): void;
57
+ put(path: string, ...handlers: ServerHandler[]): void;
58
+ delete(path: string, ...handlers: ServerHandler[]): void;
59
+ patch(path: string, ...handlers: ServerHandler[]): void;
60
+ }
61
+ export interface ServerApp extends ServerRouter {
62
+ set?(key: string, value: unknown): void;
63
+ listen?(port: number, callback?: () => void): unknown;
64
+ }
65
+ export type ServerInstance = {
66
+ close(callback?: () => void): void;
67
+ };
68
+ export interface ServerAdapter {
69
+ runtime: ServerRuntime;
70
+ createApp(): ServerApp;
71
+ createRouter(): ServerRouter;
72
+ configure(app: ServerApp, port: number): void;
73
+ listen(app: ServerApp, port: number, onListen: () => void): ServerInstance;
74
+ }
75
+ export interface ServerContext {
76
+ runtime: ServerRuntime;
77
+ adapter: ServerAdapter;
78
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerRuntime = void 0;
4
+ var ServerRuntime;
5
+ (function (ServerRuntime) {
6
+ ServerRuntime["Bun"] = "bun";
7
+ })(ServerRuntime || (exports.ServerRuntime = ServerRuntime = {}));
@@ -0,0 +1,3 @@
1
+ export * from "./ServerService";
2
+ export * from "./ServerModule";
3
+ export * from "./ServerTypes";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ServerService"), exports);
18
+ __exportStar(require("./ServerModule"), exports);
19
+ __exportStar(require("./ServerTypes"), exports);
@@ -0,0 +1,12 @@
1
+ import { ServerAdapter, ServerApp, ServerInstance, ServerRequest, ServerRouter, ServerRuntime, BunMultipartFile } from "../abstract/ServerTypes";
2
+ export declare class BunAdapter implements ServerAdapter {
3
+ runtime: ServerRuntime;
4
+ createApp(): ServerApp;
5
+ createRouter(): ServerRouter;
6
+ configure(app: ServerApp, _port: number): void;
7
+ listen(app: ServerApp, port: number, onListen: () => void): ServerInstance;
8
+ }
9
+ type MultipartFile = BunMultipartFile;
10
+ export declare function getFiles(req: ServerRequest, field: string): MultipartFile[];
11
+ export declare function getFile(req: ServerRequest, field: string): MultipartFile | undefined;
12
+ export {};