Home / Function/ POST() — astro Function Reference

POST() — astro Function Reference

Architecture documentation for the POST() function in recipes.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  80604045_2ae8_02f3_e3eb_0aab9146d6ff["POST()"]
  85e84682_aa71_4d8d_24b9_2fddda7659d7["recipes.js"]
  80604045_2ae8_02f3_e3eb_0aab9146d6ff -->|defined in| 85e84682_aa71_4d8d_24b9_2fddda7659d7
  style 80604045_2ae8_02f3_e3eb_0aab9146d6ff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/node/test/fixtures/api-route/src/pages/recipes.js lines 2–24

export async function POST({ request }) {
	let body = await request.json();
	const recipes = [
		{
			id: 1,
			name: 'Potato Soup'
		},
		{
			id: 2,
			name: 'Broccoli Soup'
		}
	];

	let out = recipes.filter(r => {
		return r.id === body.id;
	});

	return new Response(JSON.stringify(out), {
		headers: {
			'Content-Type': 'application/json'
		}
	});
}

Domain

Subdomains

Frequently Asked Questions

What does POST() do?
POST() is a function in the astro codebase, defined in packages/integrations/node/test/fixtures/api-route/src/pages/recipes.js.
Where is POST() defined?
POST() is defined in packages/integrations/node/test/fixtures/api-route/src/pages/recipes.js at line 2.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free