feat: massive front-end overhaul and initial github release
This commit is contained in:
parent
a2b40e38bf
commit
d5a0e70580
303 changed files with 19840 additions and 676 deletions
42
src/bun/api/rpc.ts
Normal file
42
src/bun/api/rpc.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { RPC_PORT } from "../../shared/constants";
|
||||
import { settings } from "./settings";
|
||||
import { romm } from "./clients";
|
||||
import Elysia from "elysia";
|
||||
import { cors } from "@elysiajs/cors";
|
||||
import { host } from "../utils";
|
||||
|
||||
const api = new Elysia({ prefix: "/api", serve: {} })
|
||||
.use(cors())
|
||||
.use(romm)
|
||||
.use(settings);
|
||||
|
||||
export type AppType = typeof api;
|
||||
|
||||
export function RunAPIServer ()
|
||||
{
|
||||
console.log("Launching API Server on port ", RPC_PORT);
|
||||
return {
|
||||
apiServer: api.listen({
|
||||
port: RPC_PORT,
|
||||
hostname: host,
|
||||
development: process.env.NODE_ENV === 'development',
|
||||
fetch (req, server)
|
||||
{
|
||||
if (server.upgrade(req, {
|
||||
data: undefined
|
||||
}))
|
||||
{
|
||||
return;
|
||||
}
|
||||
return api.fetch(req);
|
||||
},
|
||||
websocket: {
|
||||
message (ws, message)
|
||||
{
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue