S
SolidJS12mo ago
hannus

renderToString not work

I have two questions about SSR: 1. It cannot work according to document about renderToString. The browser always plain when the response is a string by renderToString. However, If the response is string that I need not to use renderToString, it works well. The code is following: import { renderToString } from "solid-js/web"; function Test() { return <div>Hello World</div>; } const server = Bun.serve({ port: 3999, fetch(request) { const html = renderToString(() => <Test />); return new Response(html, { }); // return new Response("Welcome to Bun!"); }, }); console.log(Listening on localhost:${server.port}); 2. Is solidStart too complicated to the only purpose for SSR? I just want to change my tiny project from CSR to SSR. thanks a lot.
4 Replies
lxsmnsyc
lxsmnsyc12mo ago
1. did you compile it in ssr mode? 2. well it's a metaframework so expect some additional stuff
hannus
hannusOP12mo ago
1. not yet. Actually I am freshman of modern JS, so I do not know I should compile it. Could you give me some refrrence document about how to compile it?
lxsmnsyc
lxsmnsyc12mo ago
Okay yeah since you're a "freshman" I don't think I can recommend this path. Have you tried SolidStart? it has a bare template, so you don't have to worry about routes and stuff
hannus
hannusOP12mo ago
thanks a lot, I am going to try SolidStart. I hope it is easy to learn and use. Thanks for your advice. SolidStart is cool. I am going to use solidStart to deploy my project, although there are a lot of stuffs to learn. However, it seems that the document is missing how to deploy. Is there any document to reference? Thanks
Want results from more Discord servers?
Add your server