File tree Expand file tree Collapse file tree
examples/experiments/src/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Title } from "@solidjs/meta";
22import { json } from "@solidjs/router" ;
33import { clientOnly , GET } from "@solidjs/start" ;
44import { getServerFunctionMeta } from "@solidjs/start/server" ;
5- import { getRequestEvent } from "solid-js/web" ;
5+ import { getRequestEvent , isServer } from "solid-js/web" ;
66import Counter from "~/components/Counter" ;
77const BreaksOnServer = clientOnly ( ( ) => import ( "~/components/BreaksOnServer" ) ) ;
88
@@ -22,7 +22,8 @@ export default function Home() {
2222 console . log ( v ) ;
2323 console . log ( await v . hello ) ;
2424 } ) ;
25- fetch ( `http://localhost:5173/${ import . meta. env . SERVER_BASE_URL } /unknown` , {
25+ const port = isServer ? new URL ( getRequestEvent ( ) ! . request . url ) . port : location . port ;
26+ fetch ( `http://localhost:${ port } /${ import . meta. env . SERVER_BASE_URL } /unknown` , {
2627 headers : { Accept : "application/json" }
2728 } ) . then ( async res => console . log ( await res . json ( ) ) ) ;
2829 return (
You can’t perform that action at this time.
0 commit comments