1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00
denoland-deno/std/examples
2021-01-07 05:51:15 -05:00
..
chat feat(cli): update to TypeScript 4.1 (#7573) 2020-11-24 09:31:10 +11:00
testdata fix(std/examples): add tests for examples (#4094) 2020-02-24 08:31:40 -05:00
cat.ts BREAKING CHANGE: change order of args in Deno.copy() (#4885) 2020-04-25 00:09:14 +02:00
cat_test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01:00
catj.ts build: migrate to dlint (#8176) 2020-11-03 16:19:29 +01:00
catj_test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01:00
colors.ts feat(fmt): Sort named import and export specifiers (#7711) 2020-09-27 12:22:32 +02:00
colors_test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01:00
curl.ts BREAKING CHANGE: change order of args in Deno.copy() (#4885) 2020-04-25 00:09:14 +02:00
curl_test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01:00
echo_server.ts Revert "avoid using same port number for test (#4147)" 2020-03-24 12:24:58 -04:00
echo_server_test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01:00
flags.ts refactor: Don't destructure the Deno namespace (#6268) 2020-06-12 15:23:38 -04:00
gist.ts Use dprint for internal formatting (#6682) 2020-07-14 15:24:17 -04:00
README.md fix(docs): add missing "deno run" (#5126) 2020-05-07 13:48:48 +02:00
test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01:00
test_test.ts refactor(std/example): Inconsistencies in the example tests (#7684) 2020-09-26 11:54:26 -04:00
welcome.ts Remove emoji from welcome script so it looks better on windows (#9031) 2021-01-07 05:51:15 -05:00
welcome_test.ts Remove emoji from welcome script so it looks better on windows (#9031) 2021-01-07 05:51:15 -05:00
xeval.ts build: migrate to dlint (#8176) 2020-11-03 16:19:29 +01:00
xeval_test.ts test(std): make test output less noisy (#8445) 2020-11-20 18:01:58 +01: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.