A secure runtime for JavaScript and TypeScript.
Probably every talk about Deno begins like this
deno run https://deno.land/std/examples/welcome.tsdeno repl
Deno 1.5.3
exit using ctrl+d or close()
>REPL ( read–eval–print loop)
Static file
Accorning to Ryan Dahl
...go and see the video
const raw = await fetch('https://jsonplaceholder.typicode.com/users');
const asJson = await raw.json();
console.info(asJson);
Check this...
Is something strange? Missing?
No centralized package manager
deno --help
deno 1.5.3
A secure JavaScript and TypeScript runtime
Docs: https://deno.land/manual
Modules: https://deno.land/std/ https://deno.land/x/
Bugs: https://github.com/denoland/deno/issues
SUBCOMMANDS:
bundle Bundle module and dependencies into single file
cache Cache the dependencies
completions Generate shell completions
doc Show documentation for a module
eval Eval script
fmt Format source files
help Prints this message or the help of the given subcommand(s)
info Show info about cache or info related to source file
install Install script as an executable
lint Lint source files
repl Read Eval Print Loop
run Run a program given a filename or url to the module. Use '-' as a filename to read from stdin.
test Run tests
types Print runtime TypeScript declarations
upgrade Upgrade deno executable to given versionimport { serve } from 'https://deno.land/std@0.80.0/http/server.ts';
const HTTP_OK = 200;
const DEFAULT_PORT = 8080;
const server = serve({ hostname: '0.0.0.0', port: DEFAULT_PORT });
console.log(`HTTP webserver running. Access it at: http://localhost:8080/`);
for await (const request of server) {
let bodyContent = 'Your user-agent is:\n\n';
bodyContent += request.headers.get('user-agent') || 'Unknown';
bodyContent += `\nroute: ${request.url}`;
const body = Array.from(request.headers.keys()).reduce((acc, value) => {
return `${acc}\n${value}: ${request.headers.get(value)}`;
}, bodyContent);
request.respond({ status: HTTP_OK, body });
}
Github
Documentation
Performance