std/examples
2022-08-24 10:21:57 +09:00
..
chat chore: remove void and Promise<void> return types (#2550) 2022-08-24 10:21:57 +09:00
testdata Remove unused testdata files (#744) 2021-02-19 08:11:53 -05:00
cat_test.ts refactor: switch the Deno.spawn (#2161) 2022-05-25 11:08:27 +02:00
cat.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
catj_test.ts chore: update to changes in spawn API (#2448) 2022-07-19 02:35:19 +02:00
catj.ts chore: remove void and Promise<void> return types (#2550) 2022-08-24 10:21:57 +09:00
colors_test.ts refactor: switch the Deno.spawn (#2161) 2022-05-25 11:08:27 +02:00
colors.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
curl_test.ts refactor: switch the Deno.spawn (#2161) 2022-05-25 11:08:27 +02:00
curl.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
echo_server_test.ts refactor: switch the Deno.spawn (#2161) 2022-05-25 11:08:27 +02:00
echo_server.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
flags.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
gist.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
README.md fix(docs): add missing "deno run" (denoland/deno#5126) 2021-02-01 10:46:57 +00:00
test_test.ts chore: update copyright header (#1871) 2022-02-02 23:21:39 +09:00
test.ts chore: remove void and Promise<void> return types (#2550) 2022-08-24 10:21:57 +09:00
welcome_test.ts refactor: switch the Deno.spawn (#2161) 2022-05-25 11:08:27 +02:00
welcome.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
xeval_test.ts chore: update to changes in spawn API (#2448) 2022-07-19 02:35:19 +02:00
xeval.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00

Deno example programs

This module contains small scripts that demonstrate use of Deno and its standard module.

You can run these examples using just their URL or install the example as an executable script which references the URL. (Think of installing as creating a bookmark to a program.)

A TCP echo server

deno run --allow-net https://deno.land/std/examples/echo_server.ts

Or

deno install --allow-net https://deno.land/std/examples/echo_server.ts

cat - print file to standard output

deno install --allow-read -n deno_cat https://deno.land/std/examples/cat.ts
deno_cat file.txt

catj - print flattened JSON to standard output

A very useful command by Soheil Rashidi ported to Deno.

deno install --allow-read https://deno.land/std/examples/catj.ts
catj example.json
catj file1.json file2.json
echo example.json | catj -

curl - print the contents of a url to standard output

deno run --allow-net=deno.land https://deno.land/std/examples/curl.ts https://deno.land/

gist - easily create and upload Gists

export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens
deno install --allow-net --allow-env https://deno.land/std/examples/gist.ts
gist --title "Example gist 1" script.ts
gist --t "Example gist 2" script2.ts

chat - WebSocket chat server and browser client

deno run --allow-net --allow-read https://deno.land/std/examples/chat/server.ts

Open http://localhost:8080 on the browser.