一、介绍
Deno 是原 nodejs 的作者写的新框架,直接支持 typeScript ,不需要 webpack。它遵循万物皆URL的思想,任何库,包什么的,都可以直接以URL的形式导入。甚至APP,也可以直接以URL的形式运行,比如:
deno run https://github.com/codetyphon/denoshort
二、安装
ubuntu环境 打开终端
curl -fsSL https://deno.land/install.sh | sh
windows环境 管理员模式打开powershell
iwr https://deno.land/install.ps1 -useb | iex
三、hello
新建一个文件夹 hello,在里面新建一个文件:main.ts:
console.log('hello');
运行:
deno run ./hello/main.ts
输出:
hello
四、web框架介绍
之前oak是比较成熟的框架,但目前比较火的是 fresh。
deno run -A https://fresh.deno.dev my-project
cd my-project
deno task start
五、应用例子
一个网址缩短器
deno run -A https://github.com/codetyphon/denoshort denoshort