-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Remix #12
Comments
Sure, I love Remix. Added to roadmap |
Blocking on: oven-sh/bun#1864 |
Is this unblocked now via this PR? |
Likely yes, will continue working on an adapter after the PR landed on stable (likely Bun 0.5.7) |
any update? :) |
any update? |
Apparently elysia + remix is already supported. You just need to make some tweeks |
I did also manage to make it work, though only with production mode // plugins/remix.ts
import type { ServerBuild } from "@remix-run/node";
import { createRequestHandler } from "@remix-run/node";
import { join, parse } from "path";
import { Elysia } from "elysia";
export type RemixPlugin<T extends ServerBuild = any> = (
serverBuild: T,
publicDir?: string
) => Elysia;
export const remix: RemixPlugin = (serverBuild, publicDir = join(process.cwd(), "public")) =>
new Elysia().all("*", async function ({ request, store, path, set }) {
if (request.method === "GET" && parse(path).ext) {
const filepath = join(publicDir, path);
const file = Bun.file(filepath);
const fileExist = await file.exists();
if (!fileExist) {
set.status = 404;
return { error: "Requested resource does not exist" };
}
set.headers["Cache-Control"] = "public,max-age=31536000,immutable";
return file;
}
/**
* This only works for production build
*
* For development use remix dev instead
*/
const handleRequest = createRequestHandler(serverBuild, "production");
return await handleRequest(request, store);
}); // server.ts
import { remix, logger } from "./plugins";
import { Elysia } from "elysia";
import * as build from "./build/index";
const port = process.env.PORT;
const app = new Elysia()
.state("appLoadContext", "test")
.use(logger())
.use(remix(build))
.listen(port ? Number(port) : 3000);
console.log(`Server is running at http://${app.server?.hostname}:${app.server?.port}`); // Axios accept-encoding header should be set to gzip to work
...
headers: {
common: {
"Accept-Encoding": "gzip",
},
},
... I'n not sure about this but after few clicks to test the router link, i feel that running original remix with bun is still somehow smoother than running remix by elysia 😂 It could be my implementation broke somewhere |
Any update for official remix support? |
Any update for official remix support 🥹 |
+1 |
2 similar comments
+1 |
+1 |
Is there any current path here that works now that remix uses vite? |
Any plans to support Remix with custom server adapter similar to
@remix-run/express
?The text was updated successfully, but these errors were encountered: