Skip to content

Commit 94ef1d2

Browse files
authored
updated brahma-firelight with Rust_Native Router (#10300)
* brahma-firelight added * cluster mode enabled * updated with native call-mode
1 parent fb3e557 commit 94ef1d2

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

frameworks/TypeScript/brahma-firelight/bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"": {
55
"name": "brahma-firelight",
66
"dependencies": {
7-
"brahma-firelight": "^1.5.18",
7+
"brahma-firelight": "^1.5.20",
88
},
99
"devDependencies": {
1010
"@types/bun": "latest",
@@ -21,7 +21,7 @@
2121

2222
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA=="],
2323

24-
"brahma-firelight": ["[email protected].18", "", {}, "sha512-/raDDeb6/AAHYPfvTi4vWA79BjsHwh5Eg63GWJPwWzyip3mvY0tIsNeMqHit4XBdyJZ9t0UgtsvNaHGx3zqFGw=="],
24+
"brahma-firelight": ["[email protected].20", "", {}, "sha512-ACx1E77gepT1WvHskT3AP4fGoxcp2i0Wt7/0DdornEZr5R+emrA1M8YfuA9JGfpVe0bH5L1E6lZxkpldcd3YHQ=="],
2525

2626
"bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
2727

frameworks/TypeScript/brahma-firelight/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"typescript": "^5"
1515
},
1616
"dependencies": {
17-
"brahma-firelight": "^1.5.18"
17+
"brahma-firelight": "^1.5.20"
1818
}
1919
}

frameworks/TypeScript/brahma-firelight/src/main.ts

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
1-
import { createApp, type Response, type Request, type App, type NextFunction, type Handler } from "brahma-firelight";
1+
import { createApp, type Response, type Request, type App, type NextFunction, type Handler, registerRustHotpath } from "brahma-firelight";
22
import cluster from "node:cluster";
33
import os from "node:os";
44

55
const app: App = createApp();
66

77
// Server Config Middleware
8-
const serverInfo: Handler = (_req: Request, res: Response, next?: NextFunction) => {
9-
res.setHeader("Server", "brahma-firelight");
10-
res.setHeader("Connection", "keep-alive")
11-
next?.();
12-
};
8+
// const serverInfo: Handler = (_req: Request, res: Response, next?: NextFunction) => {
9+
// res.setHeader("Server", "brahma-firelight");
10+
// res.setHeader("Connection", "keep-alive")
11+
// next?.();
12+
// };
1313

1414
// JSON compute
15-
app.get("/json", serverInfo, (_req: Request, res: Response) => {
16-
res.json({ message: "Hello, World!" });
17-
});
15+
// app.get("/json", serverInfo, (_req: Request, res: Response) => {
16+
// res.json({ message: "Hello, World!" });
17+
// });
18+
19+
// PLAIN-TEXT
20+
// app.get("/plaintext", serverInfo, (_req: Request, res: Response) => {
21+
// res.text("Hello, World!");
22+
// });
23+
24+
25+
// JSON compute
26+
registerRustHotpath(
27+
"GET",
28+
"/json",
29+
200,
30+
'{"Content-Type": "application/json", "Server": "brahma-firelight"}',
31+
Buffer.from(JSON.stringify({ message: "Hello, World!" }))
32+
);
1833

1934
// PLAIN-TEXT
20-
app.get("/plaintext", serverInfo, (_req: Request, res: Response) => {
21-
res.text("Hello, World!");
22-
});
35+
registerRustHotpath(
36+
"GET",
37+
"/plaintext",
38+
200,
39+
'{"Content-Type": "text/plain", "Server": "brahma-firelight"}',
40+
Buffer.from("Hello, World!")
41+
);
2342

2443
// Port & Host
2544
const PORT = process.env.PORT || 8080;

0 commit comments

Comments
 (0)