create-cellsweb-rpc-api 1.0.29 → 1.0.30
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 +18 -88
- package/bin/create-function.js +1 -3
- package/bin/create-middleware.js +0 -0
- package/bin/create.js +2 -2
- package/package.json +18 -6
- package/template/README.md +37 -116
- package/template/src/functions/public/hello/constants.ts +0 -1
- package/template/test.ts +1 -1
- package/templates/servers/server.bun.ts +2 -2
- package/templates/servers/server.elysia.ts +2 -2
- package/templates/servers/server.express.ts +1 -1
- package/templates/servers/server.fastify.ts +1 -1
- package/templates/servers/server.hono.ts +2 -2
- package/templates/servers/server.node.ts +1 -1
- package/templates/servers/server.ultimate-express.ts +2 -2
package/README.md
CHANGED
|
@@ -1,88 +1,18 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
npm create cellsweb-rpc-api@latest my-app
|
|
20
|
-
# or
|
|
21
|
-
npx create-cellsweb-rpc-api@latest my-app
|
|
22
|
-
# or
|
|
23
|
-
pnpm create cellsweb-rpc-api@latest my-app
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Non-Interactive & Framework Flags
|
|
27
|
-
|
|
28
|
-
You can specify your preferred base web framework directly using the `--framework` (or `-f`) flag:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# 1. Vanilla Node.js (Default — zero extra dependencies, native node:http)
|
|
32
|
-
npx create-cellsweb-rpc-api@latest my-app --framework node
|
|
33
|
-
|
|
34
|
-
# 2. Express (Standard — easiest for adding traditional REST routes & middleware)
|
|
35
|
-
npx create-cellsweb-rpc-api@latest my-app --framework express
|
|
36
|
-
|
|
37
|
-
# 3. Fastify (Modern — high performance & rich plugin ecosystem)
|
|
38
|
-
npx create-cellsweb-rpc-api@latest my-app --framework fastify
|
|
39
|
-
|
|
40
|
-
# 4. Ultimate-Express (Extreme Throughput — uWebSockets.js-backed Express drop-in)
|
|
41
|
-
npx create-cellsweb-rpc-api@latest my-app --framework ultimate-express
|
|
42
|
-
|
|
43
|
-
# 5. Hono (Ultra-fast Web Standards & multi-runtime: Bun, Node.js, Deno)
|
|
44
|
-
npx create-cellsweb-rpc-api@latest my-app --framework hono
|
|
45
|
-
|
|
46
|
-
# 6. Elysia.js (Bun-native & TypeBox first-class)
|
|
47
|
-
npx create-cellsweb-rpc-api@latest my-app --framework elysia
|
|
48
|
-
|
|
49
|
-
# 7. Bun Native (Zero extra dependencies, native Bun.serve)
|
|
50
|
-
bun create cellsweb-rpc-api@latest my-app --framework bun
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Automation & CI Flags
|
|
54
|
-
- `--skip-install` / `--no-install`: Skip automated package installation.
|
|
55
|
-
- `--yes` / `-y`: Non-interactive mode using defaults.
|
|
56
|
-
- `--pm [npm|pnpm|yarn|bun]`: Specify package manager explicitly.
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Supported Base Frameworks
|
|
61
|
-
|
|
62
|
-
| Framework | Dependencies | Description |
|
|
63
|
-
| :--- | :--- | :--- |
|
|
64
|
-
| **Vanilla Node.js** *(Default)* | *None (Zero extra deps)* | Highest raw performance directly on native `node:http`. |
|
|
65
|
-
| **Express** | `express`, `@types/express` | Standard Express server; easily mount traditional REST routes alongside `/rpc`. |
|
|
66
|
-
| **Fastify** | `fastify` | Fastify server with built-in plugin adapter (`app.createFastifyPlugin()`). |
|
|
67
|
-
| **Ultimate-Express** | `ultimate-express` | Drop-in Express replacement powered by `uWebSockets.js` for extreme I/O throughput. |
|
|
68
|
-
| **Hono** | `hono`, `@hono/node-server` | Universal Web Standards engine running seamlessly across Bun, Node.js, and Edge runtimes. |
|
|
69
|
-
| **Elysia.js** | `elysia` | Bun-first web framework with native TypeBox alignment and high developer ergonomics. |
|
|
70
|
-
| **Bun Native** | *None (Zero extra deps)* | Ultra-fast execution on native `Bun.serve` with zero third-party web framework overhead. |
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Features
|
|
75
|
-
|
|
76
|
-
- **Multi-Framework Flexibility**: Choose between Vanilla Node.js, Express, Fastify, or Ultimate-Express while keeping RPC function and middleware code 100% identical.
|
|
77
|
-
- **Unified Framework CLI (`crpc`)**: Integrated single-binary developer CLI for dev with hot-reload (`crpc dev`), production build (`crpc build`), serving (`crpc start`), and test suites (`crpc test`).
|
|
78
|
-
- **Pre-wired `@cellsweb/rpc-core`**: High performance $O(1)$ dispatching engine with sub-microsecond JIT schema validation.
|
|
79
|
-
- **Interactive & AI Batch Generators**: Built-in CLI scripts for adding new functions (`crpc create:function`) and middlewares (`crpc create:middleware`) supporting non-interactive flags, JSON batch scaffolding (`--batch '<JSON>'`), and file specs (`--file spec.json`).
|
|
80
|
-
- **Security & Integration Audit Testing**: Built-in in-process security audit test harness with HTML/JSON report generation (`crpc test:audit`).
|
|
81
|
-
- **Pre-scaffolded Common Middlewares**: Includes `auth` (JWT verification stub) and `rateLimit` (in-memory rate limiting).
|
|
82
|
-
- **Pluggable Extensions**: Modular application-level `env.ts` (TypeBox), `telemetry.ts` (Sentry), and `storage.ts` (Local/S3 uploads).
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## License
|
|
87
|
-
|
|
88
|
-
MIT © Minhazur Rahman
|
|
1
|
+
# create-cellsweb-rpc-api
|
|
2
|
+
|
|
3
|
+
Prepared candidate 1.0.30, not published by this work. Public 1.0.29 is older.
|
|
4
|
+
The candidate generates core^1.0.34 and Node >=24.0.0; publish that core before
|
|
5
|
+
publishing this scaffolder. Test unpublished candidates with local packed SDK
|
|
6
|
+
dependencies rather than resolving the older public SDK silently.
|
|
7
|
+
|
|
8
|
+
After publication: `npx create-cellsweb-rpc-api@1.0.30 my-api --framework=node`.
|
|
9
|
+
Supported framework names are node, bun, elysia, express, fastify, hono and
|
|
10
|
+
ultimate-express. Use --yes --skip-install for explicit automation, then install,
|
|
11
|
+
typecheck, build and test. Bun 1.3.11 is tested separately for Bun/Elysia execution;
|
|
12
|
+
Node 24 LTS is primary. Hono's tested Node host does not imply Edge discovery.
|
|
13
|
+
|
|
14
|
+
Generated src/env.ts loads dotenv with process exports taking precedence.
|
|
15
|
+
Production docs require parsed API_DOCS_ENABLED=true; other environments keep
|
|
16
|
+
the development default. Explicit app docs:false overrides it. Auth modules are
|
|
17
|
+
customization stubs; supply real verification. Legacy isPublic is not generated.
|
|
18
|
+
See repository docs/cli.md, docs/adapters.md and RELEASE.md for exact workflow.
|
package/bin/create-function.js
CHANGED
|
@@ -136,7 +136,6 @@ import { File, Files } from "@cellsweb/rpc-core";
|
|
|
136
136
|
|
|
137
137
|
export const metadata = {
|
|
138
138
|
description: "${descriptionStr}",
|
|
139
|
-
isPublic: ${ns.startsWith("public")},
|
|
140
139
|
deprecated: false,
|
|
141
140
|
tags: ["upload"] as string[],
|
|
142
141
|
};
|
|
@@ -173,7 +172,7 @@ export const outputSchema = Type.Object({
|
|
|
173
172
|
* SCHEMA & CONTRACT DEFINITION
|
|
174
173
|
*
|
|
175
174
|
* WHAT TO TOUCH:
|
|
176
|
-
* - metadata: Description,
|
|
175
|
+
* - metadata: Description, deprecation, tags.
|
|
177
176
|
* - contentType: "application/json" (default).
|
|
178
177
|
* - inputSchema: Define fields expected in req.body.data. Include description in Type properties!
|
|
179
178
|
* - outputSchema: Define structure returned by run(). Include description in Type properties!
|
|
@@ -183,7 +182,6 @@ import { Type } from "@sinclair/typebox";
|
|
|
183
182
|
|
|
184
183
|
export const metadata = {
|
|
185
184
|
description: "${descriptionStr}",
|
|
186
|
-
isPublic: ${ns.startsWith("public")},
|
|
187
185
|
deprecated: false,
|
|
188
186
|
tags: [] as string[],
|
|
189
187
|
};
|
package/bin/create-middleware.js
CHANGED
|
File without changes
|
package/bin/create.js
CHANGED
|
@@ -217,10 +217,10 @@ async function main() {
|
|
|
217
217
|
"create:middleware": "crpc create:middleware",
|
|
218
218
|
},
|
|
219
219
|
engines: {
|
|
220
|
-
node: ">=
|
|
220
|
+
node: ">=24.0.0",
|
|
221
221
|
},
|
|
222
222
|
dependencies: {
|
|
223
|
-
"@cellsweb/rpc-core": "^1.0.
|
|
223
|
+
"@cellsweb/rpc-core": "^1.0.34",
|
|
224
224
|
"@aws-sdk/client-s3": "^3.700.0",
|
|
225
225
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
226
226
|
"@sentry/node": "^8.40.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cellsweb-rpc-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"template",
|
|
17
17
|
"templates"
|
|
18
18
|
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --import tsx --test --test-concurrency=1 test/*.test.mjs"
|
|
21
|
+
},
|
|
19
22
|
"keywords": [
|
|
20
23
|
"rpc",
|
|
21
24
|
"create-app",
|
|
@@ -27,18 +30,27 @@
|
|
|
27
30
|
"license": "MIT",
|
|
28
31
|
"repository": {
|
|
29
32
|
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/
|
|
33
|
+
"url": "git+https://github.com/CellsWeb/crpc-node.git"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"@clack/prompts": "^1.7.0",
|
|
34
37
|
"tinyglobby": "^0.2.17"
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
40
|
+
"@hono/node-server": "^1.19.19",
|
|
37
41
|
"@sinclair/typebox": "^0.34.52",
|
|
42
|
+
"@types/express": "^5.0.6",
|
|
38
43
|
"@types/node": "^26.6.6",
|
|
39
|
-
"dotenv": "^17.4.2"
|
|
44
|
+
"dotenv": "^17.4.2",
|
|
45
|
+
"elysia": "^1.4.32",
|
|
46
|
+
"express": "^4.22.3",
|
|
47
|
+
"fastify": "^5.12.8",
|
|
48
|
+
"hono": "^4.13.18",
|
|
49
|
+
"tsx": "^4.22.0",
|
|
50
|
+
"typescript": "^7.0.2",
|
|
51
|
+
"ultimate-express": "^2.2.4"
|
|
40
52
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=24.0.0"
|
|
43
55
|
}
|
|
44
|
-
}
|
|
56
|
+
}
|
package/template/README.md
CHANGED
|
@@ -1,116 +1,37 @@
|
|
|
1
|
-
# CellsWeb RPC
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Single API Endpoint (`POST /rpc` or `POST /api`)
|
|
43
|
-
|
|
44
|
-
### JSON Request Example
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"namespace": "public",
|
|
48
|
-
"functionName": "hello",
|
|
49
|
-
"data": {
|
|
50
|
-
"name": "Alice"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Multipart Request Example (`Content-Type: multipart/form-data`)
|
|
56
|
-
Pass form-data fields:
|
|
57
|
-
- `namespace`: `"public"`
|
|
58
|
-
- `functionName`: `"uploadAvatar"`
|
|
59
|
-
- `title`: `"My Avatar"`
|
|
60
|
-
- `avatar`: `<file attachment>`
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## Creating Functions & Middlewares
|
|
65
|
-
|
|
66
|
-
### Scaffold a New Function
|
|
67
|
-
```bash
|
|
68
|
-
pnpm run create:function
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Generates:
|
|
72
|
-
```txt
|
|
73
|
-
src/functions/{namespace}/{functionName}/
|
|
74
|
-
├── constants.ts — Metadata, accepted Content-Type, and TypeBox schemas
|
|
75
|
-
├── run.ts — Business logic handler
|
|
76
|
-
├── middlewares.ts — Declarative middleware pipeline ({ name, options })
|
|
77
|
-
└── test.ts — Vitest unit test
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Scaffold a New Middleware
|
|
81
|
-
```bash
|
|
82
|
-
pnpm run create:middleware
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Generates:
|
|
86
|
-
```txt
|
|
87
|
-
src/middlewares/{middlewareName}/
|
|
88
|
-
├── constants.ts — Metadata, headersSchema, and optionsSchema
|
|
89
|
-
├── run.ts — Middleware logic (receives headers, options, function, context)
|
|
90
|
-
└── test.ts — Vitest unit test
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Storage & File Uploads
|
|
96
|
-
|
|
97
|
-
Use `storage.upload()` inside function `run.ts`:
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
import { storage } from "@/utils/storage";
|
|
101
|
-
|
|
102
|
-
export const run = async (input, _context) => {
|
|
103
|
-
const fileBuffer = await input.avatar.toBuffer();
|
|
104
|
-
const saved = await storage.upload(fileBuffer, input.avatar.filename, "avatars");
|
|
105
|
-
return { url: saved.url };
|
|
106
|
-
};
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Set `UPLOAD_MODE=s3` in `.env` along with `S3_BUCKET`, `S3_REGION`, `S3_ACCESS_KEY`, `S3_SECRET_KEY` to switch to S3 mode seamlessly.
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Interactive Documentation & Health
|
|
114
|
-
|
|
115
|
-
- **Interactive API Docs**: Visit `http://localhost:4000/docs` in your browser.
|
|
116
|
-
- **Health Check**: `GET http://localhost:4000/health`.
|
|
1
|
+
# Generated CellsWeb RPC application
|
|
2
|
+
|
|
3
|
+
Node 24 LTS is primary (engines >=24.0.0). Bun/Elysia templates run under Bun,
|
|
4
|
+
tested separately with 1.3.11. Install dependencies, then run:
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm run typecheck
|
|
8
|
+
npm test
|
|
9
|
+
npm run build
|
|
10
|
+
npm start
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The generated core requirement is ^1.0.34. Before that candidate is published,
|
|
14
|
+
select its local tarball explicitly for local testing. The public older SDK does
|
|
15
|
+
not contain every reviewed fix. See the source repository RELEASE.md.
|
|
16
|
+
|
|
17
|
+
Use npm run dev for Node development. For Bun select Bun execution, for example
|
|
18
|
+
`bun run src/server.ts` with the Bun-native template. The local crpc CLI supplies
|
|
19
|
+
function/middleware generation, build and tests. Complete templates cover native
|
|
20
|
+
Node, Express, Fastify, Hono, Ultimate Express, Bun and Elysia.
|
|
21
|
+
|
|
22
|
+
src/env.ts loads .env without overriding exported values. API_PORT/API_HOST
|
|
23
|
+
default to 4000/0.0.0.0. Docs are enabled outside production; production requires
|
|
24
|
+
parsed API_DOCS_ENABLED=true (true/false/1/0, trimmed and case-insensitive).
|
|
25
|
+
To disable even in development set the explicit CoreRPC docs:false option.
|
|
26
|
+
Disabling docs blocks their pages, not function execution. No visibility flag
|
|
27
|
+
exists; deprecated isPublic is ignored and new functions omit it.
|
|
28
|
+
|
|
29
|
+
Replace the generated auth stub with real credential verification. Middleware
|
|
30
|
+
owns authentication/authorization; remote clients forward headers, not trusted
|
|
31
|
+
context or a middleware-skip switch. Function input/output schemas remain active.
|
|
32
|
+
|
|
33
|
+
Use File/Files for uploads. Node UploadedFile exposes path, filename, mimeType,
|
|
34
|
+
byteLength and stream/buffer/blob methods. Persist into application-owned storage
|
|
35
|
+
while the handler runs; temporary uploads are cleaned afterward. Use configured
|
|
36
|
+
limits and top-level/direct-array file fields. Fetch multipart may buffer at the
|
|
37
|
+
runtime boundary; no zero-memory guarantee is implied.
|
package/template/test.ts
CHANGED
|
@@ -50,7 +50,7 @@ describe("CellsWeb RPC API Boilerplate Suite", () => {
|
|
|
50
50
|
fs.writeFileSync(
|
|
51
51
|
path.join(echoDir, "constants.ts"),
|
|
52
52
|
`import { Type } from "@sinclair/typebox";
|
|
53
|
-
export const metadata = { description: "echo"
|
|
53
|
+
export const metadata = { description: "echo" };
|
|
54
54
|
export const contentType = "application/json";
|
|
55
55
|
export const inputSchema = Type.Object({ message: Type.String({ minLength: 2 }) });
|
|
56
56
|
export const outputSchema = Type.Object({ reply: Type.String() });`,
|
|
@@ -13,7 +13,7 @@ export const app = new CoreRPC({
|
|
|
13
13
|
middlewaresDir: "./src/middlewares",
|
|
14
14
|
port: env.API_PORT,
|
|
15
15
|
host: env.API_HOST,
|
|
16
|
-
docs: true,
|
|
16
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
export const fetchHandler = async (req: Request): Promise<Response> => {
|
|
@@ -36,7 +36,7 @@ export const fetchHandler = async (req: Request): Promise<Response> => {
|
|
|
36
36
|
},
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
return new Response(result.buffer, {
|
|
39
|
+
return new Response(new Uint8Array(result.buffer), {
|
|
40
40
|
status: 200,
|
|
41
41
|
headers: {
|
|
42
42
|
"Content-Type": result.mimeType,
|
|
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
|
|
|
14
14
|
middlewaresDir: "./src/middlewares",
|
|
15
15
|
port: env.API_PORT,
|
|
16
16
|
host: env.API_HOST,
|
|
17
|
-
docs: true,
|
|
17
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export const server = new Elysia();
|
|
@@ -36,7 +36,7 @@ server.get("/uploads/*", async ({ path }) => {
|
|
|
36
36
|
},
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
return new Response(result.buffer, {
|
|
39
|
+
return new Response(new Uint8Array(result.buffer), {
|
|
40
40
|
status: 200,
|
|
41
41
|
headers: {
|
|
42
42
|
"Content-Type": result.mimeType,
|
|
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
|
|
|
14
14
|
middlewaresDir: "./src/middlewares",
|
|
15
15
|
port: env.API_PORT,
|
|
16
16
|
host: env.API_HOST,
|
|
17
|
-
docs: true,
|
|
17
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export const server: Express = express();
|
|
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
|
|
|
14
14
|
middlewaresDir: "./src/middlewares",
|
|
15
15
|
port: env.API_PORT,
|
|
16
16
|
host: env.API_HOST,
|
|
17
|
-
docs: true,
|
|
17
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export const server = Fastify({ logger: false });
|
|
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
|
|
|
14
14
|
middlewaresDir: "./src/middlewares",
|
|
15
15
|
port: env.API_PORT,
|
|
16
16
|
host: env.API_HOST,
|
|
17
|
-
docs: true,
|
|
17
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export const server = new Hono();
|
|
@@ -33,7 +33,7 @@ server.get("/uploads/*", async (c) => {
|
|
|
33
33
|
404,
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
|
-
return new Response(result.buffer, {
|
|
36
|
+
return new Response(new Uint8Array(result.buffer), {
|
|
37
37
|
status: 200,
|
|
38
38
|
headers: {
|
|
39
39
|
"Content-Type": result.mimeType,
|
|
@@ -14,7 +14,7 @@ export const app = new CoreRPC({
|
|
|
14
14
|
middlewaresDir: "./src/middlewares",
|
|
15
15
|
port: env.API_PORT,
|
|
16
16
|
host: env.API_HOST,
|
|
17
|
-
docs: true,
|
|
17
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const rpcHandler = await app.createHandler();
|
|
@@ -14,10 +14,10 @@ export const app = new CoreRPC({
|
|
|
14
14
|
middlewaresDir: "./src/middlewares",
|
|
15
15
|
port: env.API_PORT,
|
|
16
16
|
host: env.API_HOST,
|
|
17
|
-
docs: true,
|
|
17
|
+
docs: env.NODE_ENV !== "production" || env.API_DOCS_ENABLED === true,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
export const server = express();
|
|
20
|
+
export const server: ReturnType<typeof express> = express();
|
|
21
21
|
const rpcHandler = await app.createHandler();
|
|
22
22
|
|
|
23
23
|
// ── Static Files Route (/uploads/*) ──
|