安裝nodejs tsc cnpm vscode 這些略
如果網絡慢,可以考慮使用CNPM
一. 基本WebServer模塊環境
1. 命令行 npm init
初始化一個目錄為nodejs項目
2.命令行 tsc –init
初始化tsconfig文件
3.命令行 npm install @types/node --save-dev
安裝相應的nodejs ts定義文件
二、配置文件
1.tsconfig.json
Tsconfig 注意nodejs 固定模塊為commonjs
Outdir 指定一下
2.Package.json
Package.json 注意配置入口程序
三、代碼
一個app.ts,這是最簡的webserver