Skip to content
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

server functions: allow get requests #303

Merged
merged 2 commits into from
Jun 17, 2024
Merged

server functions: allow get requests #303

merged 2 commits into from
Jun 17, 2024

Conversation

OrJDev
Copy link
Contributor

@OrJDev OrJDev commented May 30, 2024

	const get1 = async () => {
		const res = await fetch("http:https://localhost:3000/_server", {
			method: "GET",
			headers: {
				"Server-Action":
					"/Users/or/Desktop/vinxi/examples/solid/ssr/basic/app/getActions.tsx#getAction",
			},
		});
		const data = await res.json();
		console.log(data);
	};

this is now valid, i was also trying to make this valid:

	const get2 = async () => {
		const res = await fetch(
			`http:https://localhost:3000/_server?serveract=${encodeURIComponent(
				"/Users/or/Desktop/vinxi/examples/solid/ssr/basic/app/getActions.tsx#getAction",
			)}`,
			{
				method: "GET",
			},
		);
		const data = await res.json();
		console.log(data);
	};

but the codebase was so messy and untyped i barely could have got anything moving. this is useful for an open graph library we are building as a part of solid mediakit.

i'm aware that params don't exist when making a get request and that is fine we don't need this rn, we just need the base working.

Copy link

codesandbox bot commented May 30, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

changeset-bot bot commented May 30, 2024

🦋 Changeset detected

Latest commit: 0d6b09b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@vinxi/server-functions Patch
vinxi Patch
@vinxi/react-server Patch
react-rsc-spa Patch
react-rsc-ssr Patch
solid-ssr-basic Patch
example-vanilla-spa Patch
example-vanilla-stack Patch
test-react-rsc Patch
test-react-srv-fn Patch
test-react-to-web-request Patch
@vinxi/router Patch
example-react-server Patch
example-react-spa-basic Patch
react-spa-mdx Patch
react-spa-tanstack-router-app Patch
example-react-spa-tanstack-router-app Patch
react-ssr-basic-cloudflare Patch
react-ssr-basic Patch
react-ssr-tanstack-router-app Patch
react-ssr-wouter Patch
solid-spa-basic Patch
example-ssr-solid-router Patch
example-vanilla-empty Patch
example-vanilla-partyroom Patch
example-vanilla-server Patch
example-vanilla-trpc Patch
test-multi-spa Patch
react-ssr-test-fs Patch
test-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 30, 2024

@OrJDev is attempting to deploy a commit to the Nikhil Saraf's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Brendonovich
Copy link
Contributor

Brendonovich commented Jun 10, 2024

@OrJDev Start's server functions can already be called with GET, solid-router does it.
image

From what I can tell vinxi-server-functions/server-handler.js isn't actually used by Start, it supplies its own.

Copy link

vercel bot commented Jun 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vinxi-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 7:17pm

@nksaraf nksaraf merged commit 9b490b7 into nksaraf:main Jun 17, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants