1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-30 11:16:38 -05:00
denoland-deno/std/examples
2020-05-04 12:27:06 -04:00
..
chat BREAKING: make WebSocket directly implement AsyncIterable (#5044) (#5045) 2020-05-04 12:27:06 -04:00
testdata fix(std/examples): add tests for examples (#4094) 2020-02-24 08:31:40 -05:00
tests BREAKING: remove CLI 'deno script.ts' hack (#5026) 2020-05-04 13:03:30 +02:00
cat.ts BREAKING CHANGE: change order of args in Deno.copy() (#4885) 2020-04-25 00:09:14 +02:00
catj.ts BREAKING: feat(cli/installer): Support guessing the executable name (#5036) 2020-05-01 15:33:11 -04:00
colors.ts reduce unnecessary output on tests (#4148) 2020-02-27 15:12:04 -05:00
curl.ts BREAKING CHANGE: change order of args in Deno.copy() (#4885) 2020-04-25 00:09:14 +02:00
echo_server.ts Revert "avoid using same port number for test (#4147)" 2020-03-24 12:24:58 -04:00
gist.ts Add hint on how to install gist program (#5041) 2020-05-02 18:35:25 -04:00
README.md BREAKING: feat(cli/installer): Support guessing the executable name (#5036) 2020-05-01 15:33:11 -04:00
test.ts BREAKING: remove overload of Deno.test() (#4951) 2020-04-28 12:33:09 +02:00
welcome.ts Add std/examples/welcome.ts (#3181) 2019-10-23 09:57:08 -07:00
xeval.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04: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  --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 --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 --allow-net --allow-read https://deno.land/std/examples/chat/server.ts

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