This commit is contained in:
Rizky
2024-04-25 15:32:14 +07:00
parent 9771281430
commit 98333a82a8
4 changed files with 104 additions and 25 deletions
+4 -2
View File
@@ -72,13 +72,12 @@ export const createServer = async () => {
}
}
await g.deploy.server?.init?.();
g.server = Bun.serve({
port: g.port,
maxRequestBodySize: 1024 * 1024 * 128,
async fetch(req) {
const url = new URL(req.url) as URL;
const prasi = {};
const handle = async (req: Request) => {
const api = await serveAPI(url, req);
@@ -146,6 +145,7 @@ export const createServer = async () => {
server: g.server,
url: { pathname: url.pathname, raw: url },
index: g.deploy.index,
prasi,
});
} catch (e) {
console.error(e);
@@ -163,3 +163,5 @@ export const createServer = async () => {
g.log.info(`Started at port: ${g.server.port}`);
}
};
await g.deploy.server?.init?.({ port: g.server.port });