deno.land / x / opine@2.3.4 / examples / content-negotiation
An example of how to perform content negotiation using the res.format() method
in an Opine server.
Run this example using:
deno run --allow-net --allow-read ./examples/content-negotiation/index.tsif have the repo cloned locally OR
deno run --allow-net --allow-read https://raw.githubusercontent.com/cmorten/opine/main/examples/content-negotiation/index.tsif you don't!
Then try:
curl -X GET http://localhost:3000 -H 'Accept: text/plain' - should see a
plaintext list.curl -X GET http://localhost:3000 -H 'Accept: application/json' - should
see a JSON object.You can also try the above on the /users route.
Version Info