wip fix
This commit is contained in:
parent
e66bd5fc1f
commit
80db2618fc
|
|
@ -2,6 +2,7 @@ import { apiContext } from "service-srv";
|
|||
import { SinglePage, g } from "utils/global";
|
||||
import { gzipAsync } from "utils/gzip";
|
||||
import { getContent } from "../server/prep-api-ts";
|
||||
import mime from "mime";
|
||||
|
||||
export const _ = {
|
||||
url: "/_prasi/**",
|
||||
|
|
@ -20,6 +21,8 @@ export const _ = {
|
|||
if (gz) {
|
||||
const path = parts.slice(1).join("/");
|
||||
if (gz.code.site[path]) {
|
||||
const type = mime.getType(path);
|
||||
if (type) res.setHeader("content-type", type);
|
||||
res.send(
|
||||
gz.code.site[path],
|
||||
req.headers.get("accept-encoding") || ""
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export const createServer = async () => {
|
|||
return arg;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
g.server = Bun.serve({
|
||||
port: g.port,
|
||||
maxRequestBodySize: 1024 * 1024 * 128,
|
||||
|
|
@ -73,6 +73,7 @@ export const createServer = async () => {
|
|||
|
||||
const handle = async (req: Request) => {
|
||||
const api = await serveAPI(url, req);
|
||||
|
||||
if (api) {
|
||||
return api;
|
||||
}
|
||||
|
|
@ -131,7 +132,7 @@ export const createServer = async () => {
|
|||
(await existsAsync(dir(`app/web/server/index.js`)))
|
||||
) {
|
||||
const res = require(dir(`app/web/server/index.js`));
|
||||
if (res && typeof res.server === 'object') {
|
||||
if (res && typeof res.server === "object") {
|
||||
g.deploy.server = res.server;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue