Run the following to start the example.
deno run \
--allow-net="0.0.0.0:5000" --reload \
--import-map https://deno.land/x/async_channels/scripts/import_map.json \
https://deno.land/x/async_channels/examples/middleware/ping_pong.ts
This will return a message from an upcoming (or waiting) POST /api/pong
request.
curl 'http://localhost:5000/api/ping'
This will return a message from an upcoming (or waiting) POST /api/ping
request.
curl 'http://localhost:5000/api/pong'
This will send the request body to an upcoming (or waiting) GET /api/pong
request.
curl 'http://localhost:5000/api/ping' --data-raw 'PING'
This will send the request body to an upcoming (or waiting) GET /api/ping
request.
curl 'http://localhost:5000/api/pong' --data-raw 'PONG'
paths that don't begin with /api
will return a static response.
curl 'http://localhost:5000/hello'
# => Hi from /hello