This example demonstrates how to handle POST requests in Deno Deploy.
The example is deployed at https://post.deno.dev for demo.
A POST request with JSON body:
curl -X POST \
-H 'content-type: application/json' \
-d '{ "name": "Deno" }' https://post.deno.dev
Response:
{
"json": {
"name": "Deno"
}
}
A POST request with form data:
curl -X POST -F 'name=Deno' https://post.deno.dev
Response:
{
"form": {
"name": "Deno"
}
}
You can run the example program on your machine using
deno
:
deno run https://raw.githubusercontent.com/denoland/deploy_examples/main/post_request/mod.js